[SELECT ALL] Code:
// Smooth sniper rifle scope zoom (using mouse wheel) script for AC 1.3+ by Bukz
ZOOM_SMOOTH = 1 // set to 0 to disable smooth zooming
ZOOM_SMOOTH_MILLIS_BETWEEN_CHANGES = 15 // milliseconds between scopefov changes for smooth zooming
ZOOM_DEFAULT_SCOPEFOV = 50 // default scopefov for when you first scope in
ZOOM_SCOPEFOV_INCREMENT = 10 // change scopefov by this much on every tick of the mouse wheel
const isany [ bool = 0; looplist $arg2 ia [ if (strcmp $ia $arg1) [ bool = 1; break ] ]; result $bool ]
const validscopefov [ result (checkrange $arg1 5 60) ]
const doscope [
if (! $numargs) [
scopefov $ZOOM_DEFAULT_SCOPEFOV
setscope 1
onrelease [ setscope 0 ]
] [
newfov = -1
if (isany $arg1 [in 1 +]) [
oper = -
newfov = (- $scopefov $ZOOM_SCOPEFOV_INCREMENT)
dif = (- $scopefov $newfov)
] [
if (isany $arg1 [out 0 -]) [
oper = +
newfov = (+ $scopefov $ZOOM_SCOPEFOV_INCREMENT)
dif = (- $newfov $scopefov)
]
]
if (validscopefov $newfov) [
if $ZOOM_SMOOTH [
loop sf $dif [
sleep (* $ZOOM_SMOOTH_MILLIS_BETWEEN_CHANGES $sf) [
newfov = ($oper $scopefov 1)
if (validscopefov $newfov) [ scopefov $newfov ]
]
]
] [ scopefov $newfov ]
]
]
]
altaction_5 = doscope
delta_game_0 = [
if (&& (= (curweapon) 5) (player1 scoping)) [
if (= $arg1 1) [ doscope + ] [ doscope - ]
] [
if (= $arg1 1) [ shiftweapon 1 ] [ shiftweapon -1 ]
]
]