Age of Kings Heaven 139
Welcome
Downloads Home
Best Files
Review Guidelines
Main site
Forums
Code of Conduct
Search

Advanced Search
Utilities
Home
New Releases
New Reviews
New Comments
Top-Rated

Submit File
Browse Categories
New Files
Recent Updates
No new files

Downloads Home » Utilities » Trigger execution order bug fixer and trigtext to trigger script converter

Download File Post Review Post Comment

Trigger execution order bug fixer and trigtext to trigger script converter

Author File Description
mullikine
File Details
Version: The Conquerors
Trigger Studio does this now! Don't bother unless you just wanna read the code!

~

If your main scenario editor is trigger studio and you want to work on a scenario with lots of triggers, this might save you lots of time.

An example problem:

You're working on a scenario with a unit spawn point, like cba. One of these triggers creates a unit. A trigger further down the list moves the unit. For some reason it's not working exactly the way it should. Most likely, a unit is created but it doesn't move, or there is a delay before it moves. But the triggers appear fine.


Explanation:

The movement trigger was probably created first and the create unit trigger second.

Moving them up and down in Aok's built-in scenario editor wont change the execution order. Neither will moving them in Trigger Studio.

If you don't have that problem then you're probably setting timers everywhere. But you wouldn't need to use timers had you have known from the very start exactly how many triggers there will be in the final product and what order they will be in.

Out of order triggers are undetectable and hard to debug. That's why I've made these two scripts, to sync the execution order to the order in which they appear.

If you run this script every time you save a new version of your scenario, you have the peace of mind that all the triggers will execute in the order they appear and you wont have to search for that bad trigger and cut and paste every trigger using trigger studio to get them in the right order (that's a bad thing to do by the way as it breaks any triggers that try to activate or deactivate the trigger you just cut and pasted, which is why I've included a 2nd script for anyone who wants to move triggers without breaking them).

The second script, rearrange_triggers.py, lets you specify the name of a trigger you want to move and a trigger you want to put it next to and then it will take care of all the activate trigger effects etc. automatically. Good for if you want to move only one trigger.

This script will be superseded in a future update to trigger studio.


Prerequisites:

1. Trigger Studio (for AoHD/UP) v1.0.3.
The trigtext exporter has been updated.
http://aok.heavengames.com/blacksmith/showfile.php?fileid=12103

2. Trigger Script Editor v2.0.

3. Python for Windows
https://www.python.org/download/windows


Optional (might need this):
1. Vim for Windows.


Process:

1. Open up AOHD/AoC/AoK and go into the scenario editor. Move the triggers using the up/down arrows so that their positions reflect the order in which they should execute. Save and quit.

2. Open you scenario in Trigger Studio for HD. Export the trig text as XML. Call it trig.xml

3. Place trig.xml in the same folder as the organise_trigs.py script.

4. Run trigs.bat. This creates output.txt (Trigger script editor output). Copy the file in explorer.

5. Place your scenario in TSE's scenario folder.

6. Open up Trigger Script Editor's "script editor.bat". Load your scenario.

8. Export the triggers to a file called output.txt.

9. Paste the output.txt from step 4 into TSE's scripts folder, replacing the output.txt that was just created in step 8.

10. Optional Step (To make sure that output.txt from step 4 imports correctly, use Vim to remove the ^_ 'control' characters and any empty new lines.
This might help:
http://stackoverflow.com/questions/3844311/how-do-i-replace-or-find-non-printable-characters-in-vim-regex

11. In TSE, import the new output.txt back into your scenario.

12. Save the scenario.

Done. The triggers should now execute in the order they are displayed



Steam/GR name: E/X mantis
Voobly name: LOD_mantis
AuthorComments & Reviews   ( All | Comments Only | Reviews Only )
Rewaider Nice! Can be very useful for tricky scenarios (specially multiplayer ones)

Post Review Post Comment

HGDL v0.8.0

Login
Forum Username:


Password:




Create a new account
Forgot password?
Statistics
Downloads:116
Favorites: [Who?]0
Size:6.75 KB
Added:06/15/14
Updated:06/20/14