Event file doesn´t work

civ2units

Emperor
Joined
Feb 1, 2009
Messages
1,191
Location
Somewhere in nowhere
Maybe someone can help me:

I´m trying to use an event file for my AWI scenario, unfortunatelly it doesn´t work. The error message of the report debug is:

"WARNING - SCENEVNT HEAP GET FAILURE
Failed to create new event structure"


I know the events have a maximum memory of 100 kb, I´m currently using 88 kb. I´m using a minimum of textblocks. I´ve created a complete new file. I´ve deleted some events which aren´t really usefull (i.e. Pirate raids on the coast).

I don´t know what I have to do. My first file was about 96 kb and still worked. Is there beside a limit of memory also a limit of events (@IF functions)?
I´ve added some new event structures in the new file.
 
Are you talking about the size of the events.txt file on your hard disk? Memory capacity and file size are not the same thing. You have most definitely exceeded your memory limit.
 
Oh, I always thought that the file size was the same like the Memory capacity.

I´ve uploaded my current event file. Could you please let me know what I have to delete until the events will work? :)
 

Attachments

If you'd thought file size mattered, I'm surprised you hadn't tried removing all of the comments - but that's not necessary. In ToT each (@IF) event requires 284 bytes + strings (text). The strings are stored at the end of the events section and each string has a null terminator (an extra 0 byte). In terms of memory space, double trigger (@AND) events are considered two separate events.

The first thing I noticed when I opened the file is that you have 14 discrete Flag events to switch the Thirteen Colonies flags on in the first turn (Flag 1 is in there twice). These could all be combined into a single event by using the Mask parameter. Replace these 14 events with:

Code:
@IF
Turn
turn=1
@THEN
Flag
continuous
who=Thirteen Colonies
state=on
mask=0b11111111110100000000000000000110
@ENDIF
That saves you 3692 bytes right there. No strings in that event; the Who parameter is stored as a bitmask.

You use a number of Delayed events. Each Delayed event requires 284 bytes (no strings) of heap space. If you run out of heap space, they will never occur. See this thread at Apolyton.

Without going through the file with a fine-toothed comb, the rest looks pretty clean. You're not going to like it, but you may have to reduce the detail on troop composition. For example, instead of 3 events that produce 3 different regiments of line infantry, use 1 event that spawns 9 units of a generic type.
 
I´ve uploaded my current event file. Could you please let me know what I have to delete until the events will work? :)


I would also need a Rules and a .scn or .sav file to use the @DEBUG facility.

Are you using the Report file that @DEBUG generates in your scen development folder to find the last event that was being "compiled" when the heap size was exceeded?

Disregard. I belatedly found the download of your scen.
 
Sorry, but I hadn't spotted that an AWI download was available.


The heap overrun ocurred while a new event structure was being created for the event that follows this one:

@IF
RANDOMTURN
denominator=10
@THEN
CREATEUNIT
owner=Thirteen Colonies
unit=New York Dragoons
veteran=no
homecity=none
Randomize
locations
98,30
95,23
94,14
93,3
endlocations
@ENDIF


I'm guessing that you may not be familiar with the @DEBUG facility in TOT.

Try the following in the "American" folder that you have made available for download:

1. Replace the existing Events file with the problem one.
2. Copy a DELEVENT file into the folder.
3. Remove the ; (if any) from ;@DEBUG statement at the beginning of the Events file.
4. Delete the Report file in the folder.
5. Drag the .scn file over the DELEVENT icon. You should briefly see a small black DOS window.
6. Start TOT and begin the scen.
7. Get error message.
8. Curse (optional). ;)
9. Open Report file and go to end of the file
10. See a sequence of cryptic statements:

@IF found - creating new event structure
New event structure created

@IF RANDOMTURN found
looking for denominator=,[continuous]
found denominator=10
@THEN found

@THEN CREATEUNIT found
looking for unit=,owner=,veteran=,homecity=,[incapital],locations,endlocations,[count=]
found owner=Thirteen Colonies (king id=5)
found unit=New York Dragoons (unit id=60)
found homecity=none
found randomize
found locations
found location 0: 98, 30, 0 (map=0)
found location 1: 95, 23, 0 (map=0)
found location 2: 94, 14, 0 (map=0)
found location 3: 93, 3, 0 (map=0)
found endlocations
@ENDIF found

@IF found - creating new event structure
WARNING - SCENEVNT HEAP GET FAILURE
Failed to create new event structure


11. The above tells you that the NY Dragoons event is the last one that there was heap space for.
 
Thanks guys for your help :goodjob:

I´ve completely overworked my event file and tried to put the flags together. I also deleted most of the @DELAY triggers as they need too much memory.

Everything works now fine with my updated version. I´m uploading the new files now on the SL Wiki. :)
 
Back
Top Bottom