Code:
# menu.cog
#
#
# [Grismath]
#======================================================================================#
symbols
message activated
message playeraction
thing screen
thing camera
thing cam0
thing cam1
thing cam2
thing cam3
thing selector
int curFrame=0 local
int using=0 local
end
#======================================================================================#
code
#--------------------------------------------------------
activated:
if(GetSenderRef()==screen) {
print("Active");
SetCurrentCamera(0);
SetCameraFocus(0, camera);
using=1;
SetActionCog(GetSelfCog(), 0x7FFFFFFF);
}
return;
#--------------------------------------------------------
playeraction:
if(using==1) {
ReturnEx(0);
if(GetParam(0)==6) {
if(GetParam(2)>0) {
if(curFrame==0) return;
curFrame=curFrame-1;
MoveToFrame(selector, curFrame, .5);
}
if(GetParam(2)<0) {
if(curFrame==3) return;
curFrame=curFrame+1;
MoveToFrame(selector, curFrame, .5);
}
}
if(GetParam(0)==2) {
if(curFrame==0) call choice0;
if(curFrame==1) call choice1;
if(curFrame==2) call choice2;
if(curFrame==3) call choice3;
}
}
return;
#--------------------------------------------------------
choice0:
using=0;
SetCurrentCamera(0);
SetCameraFocus(0, cam0);
return;
#--------------------------------------------------------
choice1:
using=0;
SetCurrentCamera(0);
SetCameraFocus(0, cam1);
return;
#--------------------------------------------------------
choice2:
using=0;
SetCurrentCamera(0);
SetCameraFocus(0, cam2);
return;
#--------------------------------------------------------
choice3:
using=0;
SetCurrentCamera(0);
SetCameraFocus(0, cam3);
return;
#--------------------------------------------------------
endThis cog powers a playeraction-driven menu with a slidebar. The only problem is, when I even tap the back key slightly, the bar moves to the bottom of the menu. I've tried all means of delaying this, and I know for a fact that it moves thru the frames correctly (I got it to stop somewhere in the middle a few times). The message is called verrrry frequently as the player holds down the back key, but how would I prevent the message from being called in order to pause the slider on a single option?