its bad practice to have, if inkey$()="1", and then the same thing on the next line, as if you pressed down "1", for the 1st inkey but it was release by the time it got to the 2nd inkey itwouldent run that code, so compact it. and to make adding guns easier
and i dont know what w1,w1 etc does, as it is irrelevant in your loop, same as your arrays.
load object "gun1.x",1
load object "gun2.x",2
guncount=2
selected_gun=1
for i=1 to guncount
if scancode(i+1)=1 then selected_gun=i
hide object i
next i
show object selected_gun
thats the same code, but much simpler to add more guns, and is more efficient ingame