PDA

View Full Version : Script Execution Order



ZoriaRPG
06-18-2017, 10:51 AM
DarkDragon

This is what I have on record. I believe it is is all correct, but I would not mind outside verification, and amendments if needed.


//================================================== =====
//--- Instruction Processing Order and General Timing ---
================================================== =======

1. Instructions in Global script Init (if starting a new game)
2. Instructions in Global Script OnContinue (is resuming a game)
3. Instructions from FFCs that run on screen init, excluding draw instructions.
Note: Instructions are handled on a per-ffc basis, in ID order; so a script on ffc ID 1 runs,
then a script on ffc ID 2, up to ffc ID 32. If an ffc has no script, it is skipped.
4. Instructions immediately inside the run() function of a global active script, if the game has just loaded.
5. Instructions in the global active script's infinite loop prior to Waitdraw,
6. Instructions from an ffc script positioned after (an illegal)
Waitdraw() instruction in that script from the previous frame.
Note: Requires being on at least the second frame of a game session.
7. Screen bitmap drawing.
8. Enqueued Script Drawing from the global active script, (and from ffcs on the previous frame).
9.. Drawing Instructions in the global active script prior to Waitdraw().
10. Instructions in an ffc script, excluding draw commands.
Note: Instructions are handled on a per-ffc basis, in ID order; so a script on ffc ID 1 runs,
then a script on ffc ID 2, up to ffc ID 32. If an ffc has no script, it is skipped.
11. Screen Scrolling (2.50.2, or later)
12. Waitdraw() in a global active script.
13. Engine writing to Link->Dir and Link->Tile.
14. FFCs enqueue draws for the next frame.
Note: Instructions are handled on a per-ffc basis, in ID order; so a script on ffc ID 1 runs,
then a script on ffc ID 2, up to ffc ID 32. If an ffc has no script, it is skipped.
15. Instructions from item action scripts.
16. Instructions from item collect scripts.
17. Instructions in the global active script, called after Waitdraw()
17(b). Screen Scrolling ( 2.50.0, and 2.50.1 )]
18. Instructions in an OnExit script, if the game is exiting.
19. Return to (3).

Saffith
06-18-2017, 12:20 PM
FFCs run before the global script, even in the first frame. If the "Run Script at Screen Init" flag is checked on an FFC on the starting screen, it will actually update twice before the active global script starts.
Also, on the off chance they both run in the same frame, item action scripts run before item pickup scripts.

Dimentio
06-19-2017, 08:10 AM
Also, NES Dungeon Type will always halt the global script, from experience.

DarkDragon
06-19-2017, 10:15 AM
Also, NES Dungeon Type will always halt the global script, from experience.

Wait what?

ZoriaRPG
06-19-2017, 03:24 PM
FFCs run before the global script, even in the first frame. If the "Run Script at Screen Init" flag is checked on an FFC on the starting screen, it will actually update twice before the active global script starts.
Also, on the off chance they both run in the same frame, item action scripts run before item pickup scripts.

Oh, really? They run before global active, even without run at screen init enabled?


Also, NES Dungeon Type will always halt the global script, from experience.

Howzat precisely?! What are they NES Dungeon types stopping your global active scripts from doing?

Tamamo
06-19-2017, 09:56 PM
ZoriaRPG Yes, Screeninit is a single occurance. It causes it to run when the before the screen starts scrolling rather then after scrolling.

The first update is handled during that check
the other is always after scrolling.

ZoriaRPG
06-19-2017, 10:11 PM
ZoriaRPG Yes, Screeninit is a single occurance. It causes it to run when the before the screen starts scrolling rather then after scrolling.

I understand that. I just didn't realise that ffcs always ran before global active. I will update the execution ordering above.
Saffith, does that revised list appear to be correct?

Dimentio
06-23-2017, 08:26 AM
Howzat precisely?! What are they NES Dungeon types stopping your global active scripts from doing?

During Screen Init, global scripts are halted.

ZoriaRPG
06-23-2017, 02:20 PM
During Screen Init, global scripts are halted.


Test that with scrolling type set to 'No Scrolling', on a frame-by frame basis please, and tell me if it holds true. I believe that script drawing is suspended during all transitions, but not the global script itself.

You may attempt to verify this by running a global counter, and seeing if it halts during screen transitions.


... Yet more script settings that we need to define.

Dimentio
06-25-2017, 03:39 PM
but not the global script itself.

You may attempt to verify this by running a global counter, and seeing if it halts during screen transitions.

Except that's what I was doing. I have a script that drawtiles a bunch of tiles to the screen, and a counter which moves the position where those tiles are drawn diagonally up and to the left each frame. However, the tile stopped being moved diagonally for the duration of the screen transition onto the NES dungeon screen.

Saffith
06-25-2017, 04:41 PM
That ought to work. I've got several places in my own quest where stuff is drawn moving while scrolling, and it works fine. Maybe there's something else holding it up.

Tamamo
06-25-2017, 10:34 PM
Dimentio is correct, global scripts dont update during screen scrolling, only ffcs have that capability unless something has changed.
I had this problem making several of my scripts, which i why most are ffcs.

Saffith
06-26-2017, 10:14 AM
Test quest (https://www.dropbox.com/s/9j0j2o2oirw3wnt/scrollTest.qst?dl=0)
Why does no one just test things? Seriously, it takes maybe ten minutes.