Stop repeatedly_execute commands? [SOLVED]

Started by NiksterG, Fri 25/03/2005 16:16:32

Previous topic - Next topic

NiksterG

Is it possible to stop repeatedly_execute commands? I was trying it with variables, where if the variable is set to a certain value, it doesn't repeatedly_execute. However, it is not working. Help, please? :P
Check out my games! (Not all made with AGS)

DoorKnobHandle

Why would you wanna do that?

You could do this:

Code: ags

function repeatedly_execute ( )
{
   if ( var == 1 )
      Display ( EGO, "Bla" );
}


This will only display "Bla" by EGO every game cycle when your variable "var" equals 1...

Does that help at all?

By the way: Pausing the game will make only rep_ex_always ( ) run! See manual for details or ask!

NiksterG

I'm not sure this is what I want. I want the repeatedly_execute to stop because I put some script there to make one of the NPCs walk randomly around the room. However, after you give him an item, the NewRoomNPC command is used, so the character is no longer in that room. After giving the item to the NPC, a cutscene happens, bringing you to a different room, and eventually brings you back to the original room. Then the game closes because it says that the character is not there to move. This is why I want the repeatedly_execute to stop, but only when the NPC is no longer in the room, aka variable is set to different value.
Check out my games! (Not all made with AGS)

Ashen

No, [...]'s code should do what you want. Just have the NPC movement code set to run when the variable is set to 0, and then change that variable when you give the item to NPC.

Alternatively, you could use the character[].room variable, e.g.:
Code: ags

if (character[NPC].room == THISROOM && character[NPC].moving == 0) {
  MoveCharacter (NPC, 50, 160);
  MoveCharacterPath (NPC, 250, 160);
  //Move NPC code
}

Replacing THISROOM with the room number, of course.
I know what you're thinking ... Don't think that.

NiksterG

I tried all these codes, but for some reason they don't work. However, I just fixed my problem by replacing the NewRoomNPC command with the SetCharacterView command, so now the NPC is invisible. You can walk through him, and the cutscene works now. Thanks anyways! ;D
Check out my games! (Not all made with AGS)

SMF spam blocked by CleanTalk