Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: barefoot on Sat 04/12/2010 10:51:45

Title: CHANGED AND SOLVED: Mouse cursor hanging on Wait problem
Post by: barefoot on Sat 04/12/2010 10:51:45
Hi,

I have the following script but no matter how much I try and look at it I know something is wrong..

When the script gets to the very end the mouse cursor goes to Wait and you can't continue..... as if it's waiting for a block option to finish..

Can someone help please?

I hope this script is shown how you like it shown.




function oball2_UseInv()
{
 if  (player.ActiveInventory == itie){
 
 cChris.Say("I know what I can do with this robe tie!");
 cChris.Walk(123, 470, eBlock);
 cChris.LoseInventory(itie);    

 oball2.Move(43,364, 2, eBlock);
 oball2.Move(47,388, 2, eBlock);
 oball2.Move(43,328,2,  eBlock);
 oball2.Move(47,320,2,  eBlock);
 oball2.Move(49,325,2,  eBlock);
 oball2.Move(43,388, 2, eBlock);

 object[4].Visible = false;
 object[6].Visible = true;
 
 Display("The furry ball beast is angry and aggressive but you manage to overcome it and tie it up!");
 cChris.Say("Now I've got this ugly fur ball tied up I need to do something with him!! I've an idea!");
 object[6].Visible = false;
 cChris.ChangeView(85);
 cChris.LoseInventory(itie);
 
 cChris.FaceLocation(377, 455);
 cChris.Walk(298, 445, eBlock);
 Display("You turn the water on to fill the bath");
 cChris.ChangeView(80);
 object[3].Visible = true;
 object[5].Visible = true;
 Display("You lower the foul creature into the bath!!");
 cChris.Say("Die you smelly creature of satan!!!!");

 Display("Soon the fur ball breaths no more, it is dead!");
 cChris.Say("Well, I don't have to worry about this one anymore!");    // it hangs on Wait here
 object[3].Visible = false;

  }

 else cChris.Walk(123, 470, eBlock);

 oball2.Move(43,364, 2, eBlock);
 oball2.Move(47,388, 2, eBlock);
 oball2.Move(43,328,2,  eBlock);
 oball2.Move(47,320,2,  eBlock);
 oball2.Move(49,325,2,  eBlock);
 oball2.Move(43,388, 2, eBlock);

cChris.Say("That helped a lot, it tried to eat it!!"); {
 
}
}


cheers
barefoot
Title: Re: Mouse cursor hanging on Wait problem
Post by: barefoot on Sat 04/12/2010 12:24:46
Hi

after going over the script for about 3 hours I decided to change the end bit with this and it seems to work ok now  :=:

Who said it was going to be easy!  :o


function oball2_UseInv()
{
if  (player.ActiveInventory == itie){
   
  cChris.Say("I know what I can do with this robe tie!");
  cChris.Walk(139, 470, eBlock);
     
  oball2.Move(43,364, 2, eBlock);
  oball2.Move(47,388, 2, eBlock);
  oball2.Move(43,328,2,  eBlock);
  oball2.Move(47,320,2,  eBlock);
  oball2.Move(49,325,2,  eBlock);
  oball2.Move(43,388, 2, eBlock);
  object[4].Visible = false;
  object[6].Visible = true;
   
  Display("The furry ball beast is angry and aggressive but you manage to overcome it and tie it up!");
  cChris.Say("Now I've got this ugly fur ball tied up I need to do something with him!! I've an idea!");
  object[6].Visible = false;
  cChris.ChangeView(85);
 
  cChris.FaceLocation(377, 450);
  cChris.Walk(298, 450, eBlock);
  Display("You turn the water on to fill the bath");
  object[3].Visible = true;
  Display("You lower the foul creature into the bath!!");
  object[5].Visible = true;
  cChris.Say("Die you smelly creature of satan!!!!");

  cChris.ChangeView(80);
  Display("Soon the fur ball breaths no more, it is dead!");
  cChris.Say("Well, I don't have to worry about this one anymore!");
  object[3].Visible = false;
  cChris.LoseInventory(itie);
  mouse.ChangeModeView(2, 2057);


}
  if  (player.ActiveInventory == ihairsprayoff){


   cChris.Walk(123, 470, eBlock);

  oball2.Move(43,364, 2, eBlock);
  oball2.Move(47,388, 2, eBlock);
  oball2.Move(43,328,2,  eBlock);
  oball2.Move(47,320,2,  eBlock);
  oball2.Move(49,325,2,  eBlock);
  oball2.Move(43,388, 2, eBlock);

cChris.Say("That helped a lot, it tried to eat it!!"); {
   
}
}
}


barefoot
Title: Re: CHANGED AND SOLVED: Mouse cursor hanging on Wait problem
Post by: Khris on Sat 04/12/2010 16:44:19
There's a superfluous pair of brackets that's probably missing someplace else:

function oball2_UseInv() {

  if (player.ActiveInventory == itie) {
   
    cChris.Say("I know what I can do with this robe tie!");
    ...
    ...
    ...
    cChris.Say("Well, I don't have to worry about this one anymore!");    // it hangs on Wait here
    object[3].Visible = false;
  }

  else {                                                      //   <--- open else block here

    cChris.Walk(123, 470, eBlock);

    oball2.Move(43,364, 2, eBlock);
    oball2.Move(47,388, 2, eBlock);
    oball2.Move(43,328,2,  eBlock);
    oball2.Move(47,320,2,  eBlock);
    oball2.Move(49,325,2,  eBlock);
    oball2.Move(43,388, 2, eBlock);

    cChris.Say("That helped a lot, it tried to eat it!!");
  }                                                             // <---- close else block down here
}


I have no idea why the game would get stuck though and your change shouldn't affect the outcome either.
Well, as long as you got it working.