setting up triggers question

Started by madradubhcroga, Tue 08/05/2012 02:00:11

Previous topic - Next topic

madradubhcroga



Hi all.


Hard to articulate this question -

I want to make a trigger in room_RepExec() that activates something else.
Like:

room_RepExec()
{


if (object[1].Visible == false){
// then [1]
}
}


where

[1] is:

gGui12.Visible = true;
cChar3.move(222,333);
and other stuff.

Is there a name for this kind of set up?
How is it phrased and where would the [1] be defined for the computer and where should it go in the code?
(I've found it can't go in the room_RepExec() because sounds stutter, gGuis flicker and mouse pointers disappear.)

Gilbert

That's because you're doing this repeatedly. You only need to do this once.

You can use a variable to track whether the action has been carried out, for example, put on top of the script:
Code: ags

bool eventdone = false;


Then in the repeatedly executed codes:
Code: ags

room_RepExec(){
  if (object[1].Visible == false&&eventdone==false){
    gGui12.Visible = true;
    cChar3.move(222,333);
    //and other stuff.
    eventdone = true;
  }
}

madradubhcroga


Khris

Also, if it's only going to happen once, you can use Game.DoOnceOnly.
Code: ags
room_RepExec(){
  if (!object[1].Visible && Game.DoOnceOnly("room x, object 1 disappeared")) {
    gGui12.Visible = true;
    cChar3.move(222,333);
  }
}

SMF spam blocked by CleanTalk