How's this?
It uses the arrow keys instead of mouse wheel but you can easily change that.
SetWindowTitle( "scroll test" )
SetWindowSize( 1024, 768, 0 )
SetVirtualResolution( 1024, 768 )
UseNewDefaultFonts( 1 )
#constant TRUE 1
#constant FALSE 0
#constant KEY_UP 38
#constant KEY_DOWN 40
type t_WeaponSlots
avail as integer
name as String
endtype
global weaponSlots as t_WeaponSlots[5]
global currentWeaponSlot as integer
initWeaponSlots()
do
Print("Current Weapon: " + weaponSlots[currentWeaponSlot].name)
if GetRawKeyPressed(KEY_UP)
SelectWeaponSlot(-1)
endif
if GetRawKeyPressed(KEY_DOWN)
SelectWeaponSlot(1)
endif
Print("")
Print("Weapon Slots:")
for k = 0 to weaponSlots.length
PrintC(str(k) + ": " + weaponSlots[k].name + " - ")
if weaponSlots[k].avail = TRUE
Print("Available!")
else
Print("Not Available")
endif
next k
Sync()
loop
function SelectWeaponSlot(dir)
cws = currentWeaponSlot
while cws > -1 and cws < weaponSlots.length+1
cws = Clamp(cws + dir, 0, weaponSlots.length)
if weaponSlots[cws].avail = TRUE
currentWeaponSlot = cws
exitfunction
endif
endwhile
endfunction
function initWeaponSlots()
currentWeaponSlot = 0
weaponSlots[0].name = "Fists"
weaponSlots[1].name = "Dagger"
weaponSlots[2].name = "Machete"
weaponSlots[3].name = "Sword"
weaponSlots[4].name = "BroadSword"
weaponSlots[5].name = "Sabre"
for k = 0 to 5
weaponSlots[k].avail = TRUE
next k
weaponSlots[1].avail = FALSE
weaponSlots[4].avail = FALSE
endfunction
function Clamp(value, minV, maxV)
if value < minV then exitfunction minV
if value > maxV then exitfunction maxV
endfunction value
It's a full 'project' to test the code but the bit you've asked for is the
SelectWeaponSlot() function