Help with scripting in game buttons. (SOLVED)

Started by RetroJay, Fri 18/04/2008 23:58:14

Previous topic - Next topic

RetroJay

Hi all. ;)

First off I am using AGS 2.72.
I have two buttons in my game room that I have made hotspots out of. One opens a door and the other opens a monitor screen.
I have no problem getting them to do this. I want the player to be able to activate whatever button he/she wants first. This also is not a prob.
The problem I am having is this.
I want it so as if you activate the door button before the monitor button (you get sucked out into space). ;D
But If you activate the monitor button first some dialoge appears saying "It looks safe out there" or something like this.
Then you can activate the door button without the (getting sucked out into space) part.

Some help would be fantastic as it means this room would be complete and I can move on.
Thankyou. JAY.

Khris


RetroJay

#2
KhrisMUC.

Have I upset you in some way?
You have helped me before on this room and I was most gratefull.
But this has not helped me at all.

I don't understand Variables very well.
could you please be more clear.
Thankyou.
JAY.

OOh! Wait a min. Variables. Thats "IF- Blah balh. ELSE- Blah blah". Is that right. If so then YES I have been using Variables.
However I have been looking through the manual (to do with variables) and have found nothing that really helps me with my prob. Sorry!

Khris

It was bedtime and I just wanted to give you a nudge in the right direction ;)

Now, as far as I understand it, both buttons can be activated only once, right?

Code: ags
// room script

bool mon_active;           // variable, initial state: false


// somewhere inside monitor activation function:
  mon_active = true;      //  set variable to true



// door activation function:
  if (mon_active) {
    // stuff happens
  }
  else {
    // player gets sucked into space
  }

RetroJay

Aha! I see.
That SHOULD work a treat. :)
Unfortuanately I can't try it now until Monday. :(
But thankyou very much for your help Khris.
I'll let you know how it goes when I try it.
JAY.

RetroJay

Thankyou Khris.

your script worked just the way I wanted it to. ;)
I am begining to see now, after getting nowhere for so long, how "Variables" work.
I am sure that there will be many more questions though.
If everyone is as helpfull as you then I'm sure there will be no problems.

Rest assured that I WILL fight many days to solve things myself before asking for help.

Once again. Thankyou.
JAY.

SMF spam blocked by CleanTalk