Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ScottDoom on Fri 20/01/2006 07:11:29

Title: WaitMouseKey(X); Problem... (SOLVED)
Post by: ScottDoom on Fri 20/01/2006 07:11:29
DisplayMessage(500);
DisplayMessage(501);
character[KAR].Say("text here");
character[KAR].Say("text here");
DisplayMessage(502);
DisplayMessage(503);
DisplayMessage(504);
DisplayMessage(505);
DisplayMessage(506);
WaitMouseKey(80);
if (Mouse.Mode == eModeExamine) {
DisplayMessage(507); }
else {
character[KAR].Say("text here");
DisplayMessage(508); }


What I was hoping is that after DisplayMessage(506); there would be a certain amount of time (around 2 seconds) to give the player a chance to change the mouse mode, and if he didn't then the else part happens... However, when pressing a button during the wait period it just skips that and goes on...

Is there code that says something like if the button was pressed or if that wait period was skipped, then make a GUI visible? Could I use mouse.IsButtonDown code? Or is there another way for me to time the character and allow him to move, etc. during that time period until the if, else statement runs?
Title: Re: WaitMouseKey(X); Problem...
Post by: Gilbert on Fri 20/01/2006 07:22:01
WaitMouseKey(), WaitKey() or Wait() will pause your game, so your cursor probably wouldn't change during that period anyway (unless you changed your global script).
One way is to use a timer, and checks if the timer expires in repeatedly_execute() to do the rest:

DisplayMessage(500);
DisplayMessage(501);
character[KAR].Say("text here");
character[KAR].Say("text here");
DisplayMessage(502);
DisplayMessage(503);
DisplayMessage(504);
DisplayMessage(505);
DisplayMessage(506);
SetTimer(1, 80);


Then in the repeatedly execute event put:

if (IsTimerExpired (1)) {
Ã,  if (Mouse.Mode == eModeExamine) DisplayMessage(507);
Ã,  else {
Ã,  Ã,  character[KAR].Say("text here");
Ã,  Ã,  DisplayMessage(508);
Ã,  }
}

Title: Re: WaitMouseKey(X); Problem...
Post by: ScottDoom on Fri 20/01/2006 07:25:01
Sweeeeeet! Let me try this... If it works, my demo will be complete.

Thank you very much! I'm going to include everyone who helped out in the credits of my weird demo!