Got one sorta working with the mouse wheel on SVN.
It's not perfect, but it's close. I can't help but feel that this option would be much better hardcoded. Nonetheless:
[cubescript]if (! (checkalias onSpawn)) [ onSpawn = "" ]
if (! (strstr $onSpawn weapList)) [
add2alias onSpawn [
if (= $arg1 (player1 cn)) [
weapList = (concat (at $WEAPONS (currentprimary)) AKIMBO GRENADES PISTOL KNIFE) // weapon priorities, start with primary
]
]
]
// Returns a modified list with two elements swapping positions.
swapElements = [
originalList = $arg1
newlist = ""
loop i (listlen $originalList) [
if (= $arg2 $i) [
add2list newlist (at $originalList $arg3)
] [
if (= $arg3 $i) [
add2list newlist (at $originalList $arg2)
] [
add2list newlist (at $originalList $i)
]
]
]
result $newlist
]
// Updates the weapon list as weapons are cycled through.
// Element 0 should always be the next weapon in line in theory.
rebuildWeapList = [
if (strcmp $arg1 "+") [
// weapList = (swapElements $weapList 0 4)
// weapList = (swapElements $weapList 0 3)
// weapList = (swapElements $weapList 0 2)
// weapList = (swapElements $weapList 0 1)
loop i 4 [ weapList = (swapElements $weapList 0 (- 4 $i)) ]
] [
if (strcmp $arg1 "-") [
// weapList = (swapElements $weapList 0 1)
// weapList = (swapElements $weapList 0 2)
// weapList = (swapElements $weapList 0 3)
// weapList = (swapElements $weapList 0 4)
loop i 4 [ weapList = (swapElements $weapList 0 (+ $i 1)) ]
]
]
]
// Checks to see if the next weapon in line has ammunition,
// else invokes a rebuild of the weapon list and tries again.
// The first weapon in line found to have ammunition will be
// automatically switched to, assuming it is not your current
// weapon already.
weapskip = [
rebuildWeapList $arg1
loop i 5 [
if (! (checkmag (getalias (at $weapList 0)))) [
rebuildWeapList $arg1
] [
weapon (getalias (at $weapList 0))
break
]
]
]
bind mouse4 [ weapskip + ]
bind mouse5 [ weapskip - ][/cubescript]
It's only a concept, nothing you should depend on, just something to mess around with.
It's not perfect, but it's close. I can't help but feel that this option would be much better hardcoded. Nonetheless:
[cubescript]if (! (checkalias onSpawn)) [ onSpawn = "" ]
if (! (strstr $onSpawn weapList)) [
add2alias onSpawn [
if (= $arg1 (player1 cn)) [
weapList = (concat (at $WEAPONS (currentprimary)) AKIMBO GRENADES PISTOL KNIFE) // weapon priorities, start with primary
]
]
]
// Returns a modified list with two elements swapping positions.
swapElements = [
originalList = $arg1
newlist = ""
loop i (listlen $originalList) [
if (= $arg2 $i) [
add2list newlist (at $originalList $arg3)
] [
if (= $arg3 $i) [
add2list newlist (at $originalList $arg2)
] [
add2list newlist (at $originalList $i)
]
]
]
result $newlist
]
// Updates the weapon list as weapons are cycled through.
// Element 0 should always be the next weapon in line in theory.
rebuildWeapList = [
if (strcmp $arg1 "+") [
// weapList = (swapElements $weapList 0 4)
// weapList = (swapElements $weapList 0 3)
// weapList = (swapElements $weapList 0 2)
// weapList = (swapElements $weapList 0 1)
loop i 4 [ weapList = (swapElements $weapList 0 (- 4 $i)) ]
] [
if (strcmp $arg1 "-") [
// weapList = (swapElements $weapList 0 1)
// weapList = (swapElements $weapList 0 2)
// weapList = (swapElements $weapList 0 3)
// weapList = (swapElements $weapList 0 4)
loop i 4 [ weapList = (swapElements $weapList 0 (+ $i 1)) ]
]
]
]
// Checks to see if the next weapon in line has ammunition,
// else invokes a rebuild of the weapon list and tries again.
// The first weapon in line found to have ammunition will be
// automatically switched to, assuming it is not your current
// weapon already.
weapskip = [
rebuildWeapList $arg1
loop i 5 [
if (! (checkmag (getalias (at $weapList 0)))) [
rebuildWeapList $arg1
] [
weapon (getalias (at $weapList 0))
break
]
]
]
bind mouse4 [ weapskip + ]
bind mouse5 [ weapskip - ][/cubescript]
It's only a concept, nothing you should depend on, just something to mess around with.