With a ranged weapon, your attack bonus is:
Base attack bonus + Dexterity modifier + size modifier + range penalty
Some effects are rays. You aim a ray as if using a ranged weapon, though typically you make a ranged touch attack rather than a normal ranged attack.