Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: BlueAngel on Sat 20/03/2010 12:09:25

Title: (SOLVED) help with if/else
Post by: BlueAngel on Sat 20/03/2010 12:09:25
I’m so sorry but once again I need help, please.   :-[

I want the player to change room if he can get to the hotspot but there is a object in the way that he has to move first. I get the moving part right but player don’t change room and only says the else part.

At the top of the room scrip I got

bool ChairIsFree;


then I got this but only the else message keeps popping up:


function hChair_Interact()// hand cursor
{
 if (ChairIsFree){
     oDrunk.Graphic=13;
     Display("you grab the chair real fast!");
     player.ChangeRoom(5, 200, 200);
 }
 else{
   cEgo.Say("For a Dunk guy he move rather fast!");
 }


So I tried this but the same thing happen


function hChair_Interact()// hand cursor
{
   if ((ChairIsFree==true)&&(oDrunk.Visible==false)){
     Display("you grab the chair real fast!");
     player.ChangeRoom(5, 200, 200);
   }
   else{
   cEgo.Say("For a dunk guy he move rader fast!");
   }
 
 
}


I know I should know this by now but I just cant get it to work  :'(
Title: Re: help with if/else
Post by: GarageGothic on Sat 20/03/2010 12:16:36
When you declare a bool its default value will be "false", so I assume you have another piece of script that sets (ChairIsFree = true)? If so please post that bit of code too (and if not, well there's your problem right there :)).
Title: Re: help with if/else
Post by: BlueAngel on Sun 21/03/2010 11:06:01
 :D
Thank you!
That did the trick, I know it was something simple I had forgotten!
:P ::)