Change Object Visibility From GUI

Started by Spiderhund, Mon 23/03/2009 16:53:00

Previous topic - Next topic

Spiderhund

Hey I'm new here so I apologize if I'm posting in the wrong place.

So here is my problem.
I have a keypad in one of my rooms. It's just a hotspot. When I interact with it a GUI I made will popup asking for a password(In a textbox). That is all working great but now when I click on the "ok" button(On my GUI) I want it to check if the password is correct. If it is correct I want it to change the visibility of a door object in my room and then close the GUI. The door object is named "odoor".

Here is my code:

function Button1_OnClick(GUIControl *control, MouseButton button)
{
  if (textbox_pass.Text == "1527") {
    odoor.Visible = false;
    gKeypad.Visible = false;
    cJohn.Say("Well that worked.");
  }
  else
  {
    gKeypad.Visible = false;
    cJohn.Say("It doesn't seem to be working.");
  }
}


It gives me this error though.

GlobalScript.asc(516): Error (line 516): Undefined token 'odoor'


As far as I know it's because AGS doesn't know what odoor is even though the player is in the same room as odoor.
Is there a way to tell AGS to look for odoor in room3? Or is there another way around this problem.

Oh yeah btw sorry my bad english I hope you get what I mean.

monkey0506

The script o-names for hotspots and objects are only available within that specific room script. You could instead use: object[THEOBJECTID].Visible = false or CallRoomScript.

BTW, welcome to the forums. And your Engrish isn't bad at all. ;)

Spiderhund

Quote from: monkey_05_06 on Mon 23/03/2009 16:58:04
The script o-names for hotspots and objects are only available within that specific room script. You could instead use: object[THEOBJECTID].Visible = false or CallRoomScript.

BTW, welcome to the forums. And your Engrish isn't bad at all. ;)

Thanks that worked  ;D

SMF spam blocked by CleanTalk