These have existed in the star wars universe. Wookieepedia the VERPINE SNIPER RIFLE. it is essentially a rail gun, using a line of electro-magnets, firing a magnetic projectile, with not powder or combustion, no recoil, and in the Republic Commando Triple Zero book, there is an adjustable scope.

Second Aura Sing uses a auto-compensating scope in her signature Adventurer slugthrower rifle.

The very existence of flamethrowers proves that some time, somewhere, someone said to themselves, "You know, I want to set those people over there on fire, but I'm just not close enough to get the job done." -George Carlin