Author Topic: Global and Continue  (Read 1687 times)

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Global and Continue
« on: November 22, 2005, 05:16:34 AM »
Hello,

I have the feeling that setglobal takes effect when script in restart.

For example:
IF
   Global("target_found","LOCALS",1)
THEN
   RESPONSE #100
      SetGlobal("target_found","LOCALS",0)
      Continue()
END

Suppose target_found was set at 1
This block doesn't work, because for the end of script, target_found will still be at 1
It will be at 0 when script is restarted.

I am not sure at 100%
But nearly, and It could be same thing for timer.

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Global and Continue
« Reply #1 on: November 22, 2005, 04:16:39 PM »
Try putting SmallWait(1) in between the Set and Continue.
Earn Money Sleeping.

Offline cirerrek

  • Planewalker
  • *****
  • Posts: 92
Re: Global and Continue
« Reply #2 on: November 22, 2005, 09:40:45 PM »
From Goran's Scripting Guide

Triggers and variables that are set by one module can not be used in a following module until the next AI cycle begins.

Event triggers only last until the next AI cycle.  At that point they are examined and processed.

Status triggers are checked every time through the AI cycle.  As a result they always apply if they are true.

Setting a Global would be considered an event trigger, which would not be evaluated until the next AI cycle

While checking a Stat would be a status trigger and would apply during the current AI cycle, if true.     

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Re: Global and Continue
« Reply #3 on: November 23, 2005, 04:18:27 AM »
Thanks for replies, I will maybe consider these solutions. Although I don't like to add smallwait to do that, since it can slowdown my script (because I would use many of them) :)

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Global and Continue
« Reply #4 on: November 26, 2005, 07:18:56 AM »
Try putting SmallWait(1) in between the Set and Continue.
Would a BreakInstants() help there too?

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Global and Continue
« Reply #5 on: November 26, 2005, 01:52:00 PM »
To be honest, I've never even seen--much less used--BreakInstants() before.  What's it do?

Never mind.  IESDP to the rescue.  Sort of.

"178 BreakInstants()
Presumably fongs instants. And their lassies.
Really, though, this is completely untested, but I'd assume that this adds instants (seen in the INSTANT.ids) to the action list rather than performing them immediately."

Earn Money Sleeping.

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Global and Continue
« Reply #6 on: November 27, 2005, 04:29:32 AM »
BreakInstants stops immediate execution and puts the following actions in the action queue.
Effectively it is a SmallWait(0).

Actually, i doubt any of these will help because even an Instant is executed only after the script was fully evaluated.
It runs like this:

1. if the action list is not empty go to 4
2. scan script for valid triggers
3. stuff actions in the action queue (instants too)
4. execute actions but stop after the first non-instant

Some actions, i think those listed in chase.ids seem to be ignored by (1), these are still caught by ActionListEmpty() trigger
Continue() and CutScene() are not real actions, they are handled in (3)  thus more 'instant' than instants.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: