(SOLVED) help with if/else

Started by BlueAngel, Sat 20/03/2010 12:09:25

Previous topic - Next topic

BlueAngel

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
Code: ags

bool ChairIsFree;


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

Code: ags

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

Code: ags

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  :'(

GarageGothic

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 :)).

BlueAngel

 :D
Thank you!
That did the trick, I know it was something simple I had forgotten!
:P ::)

SMF spam blocked by CleanTalk