Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Delaying a message from being called.
Delaying a message from being called.
2002-12-23, 5:38 PM #1
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;
#--------------------------------------------------------
end


This 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?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-12-23, 6:58 PM #2
Put using=0; before the return; in playeraction. It'll force the player to press the button repeatedly to get it to work.
-Hell Raiser
2002-12-24, 2:20 AM #3
I don't want the player to have to hit the original switch repeatedly...
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-12-24, 6:46 AM #4
Why not just use a timer to delay the reaction...
2002-12-24, 8:39 AM #5
Ok. Well, Playeraction acts like a pulse running at like 0.000001 so why don't you put a counter in playeraction, that makes it work every 20 or so counts? (adjust if neccessary)
-Hell Raiser

↑ Up to the top!