Thanks Chris.
Everyone, here's a slight addition to the script; it's for weapon switching, or for cycling through values. The output changes from 0, to 1, 2, then 3, then cycles back to 0, every time the y button is pressed. This is really for placement in the onTick field, but you can use it as a controller. I know for a fact that it doesn't have to be this complex, but this was the easiest modification to make; I'll refine it soon, make it easier to change the number of values to cycle.
if frame==1;
setVar("repeat",0);
setVar("weapon",0);
end;
if joybutton("y")==0;
setVar("repeat",1);
getVar("weapon");
elsif getVar("repeat")==0;
getVar("weapon");
elsif getVar("weapon")==0;
setVar("repeat",0);
getSetVar("weapon",1);
elsif getVar("weapon")==1;
setVar("repeat",0);
getSetVar("weapon",2);
elsif getVar("weapon")==2;
setVar("repeat",0);
getSetVar("weapon",3);
elsif getVar("weapon")==3;
setVar("repeat",0);
getSetVar("weapon",0);
end
Ok, I've released a partially finished demo of this; see http://sketchup.google.com/3dwarehouse/details?mid=2089b6db29e339096cd8ad826e9017b8