• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

The Most Bizarre Problem

Status
Not open for further replies.
Level 13
Joined
Oct 18, 2013
Messages
690
So I run my map from War3, and all of the script on it has ceased to run.
Wutt? I have no clue how this happened xD But literally none of the script runs... I was optimizing my map using Vexorians Optimizer and found none of the script worked on any of the copies of my map I optimized. I assumed it was because of the optimizer, but even my non-optimized mapfile had the problem too. I have NEVER had this happen.

..What can even cause this? Its had to have been corrupted somehow I feel like, but idk. It opens fine in World Edit. I was thinking perhaps DestroyTrigger was fucking with my script somewhere, but it's not even just my init triggers or anything that don't run. Nothing runs. Not triggers enabled by the start of the map, or anything else. I don't know what to make of this. I'll have to find the newest backup that NewGen made, and analyze the differences.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Do you have large array variables? I know it can cause problems like this.

I was looking through the whole script for my map at one point and noticed that the code generated to initialize array variables is like "loop over entire array and set each value to default value". The variables are declared before your triggers.

What I think happens is you hit the operation limit in these mega loops and then it just kills the startup script. This means that all of your triggers are not created in the game. None of them will do anything.
 
Level 10
Joined
Jun 6, 2007
Messages
392
I recently created an array variable of length 8000 (arrays are always that long, right?) in variable manager, and that caused exactly the same problem. I don't know, but it might be possible that variables declared in the variable manager are initialized but variables declared in jass within a global block aren't, as I've never had this issue when working with jass.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I recently created an array variable of length 8000 (arrays are always that long, right?) in variable manager, and that caused exactly the same problem. I don't know, but it might be possible that variables declared in the variable manager are initialized but variables declared in jass within a global block aren't, as I've never had this issue when working with jass.

I believe this is the case, though I am unsure about the size of the array. If you look in the actual code generated, there is a function that initialises all of your global variables and it all happens during map initialisation. It sets all the variables in the array in a loop up to the size you specify in the variable editor. That is what causes it to hit the operation limit (I think).
 

EdgeOfChaos

E

EdgeOfChaos

The upper limit for arrays is 8192. If your array is over that, it will break your map.

I can't imagine needing an explicit limit over 1000. I would reduce that limit.
 
Level 13
Joined
Oct 18, 2013
Messages
690
@Zwiebelchen. For my initialization trigger, I noticed that it hit op limit because I had stupidly initialized sizes of arrays that I didn't need to have. I have long since fixed that. According to what SAUS said, this seems to be the case again. Except, instead of just my own trigger for setting variables not working, all triggers stopped working.

@SAUS, What you said is probably the case. I need to sweep through my map and remove all globals that I don't use. vJass is really useful in that you can keep your globals organized by where you use them. However, I didn't use vJass for most of my map making process, so I'm sure there are probably ~60 globals that I don't use. After that, I'll probably do some more sweeping and make sure that trigger that initializes triggers or whatever doesn't hit op limit. Thanks. I don't have any arrays with a size larger than 1. That would've been the easiest case to cut down on overhead.

I'm thinking about changing my trigger that runs on Map Initialization to something that runs after x seconds have elapsed. Would this help?

Edit1: Also, after thinking on the implications of this, couldn't you have your map set up so that it is 1-2 lines/vars/whatever away from hitting op limit to prevent insertion of cheat packs? An easy way to do this would be to have dummy variables or something. If anyone inserted a cheat pack, your map would break from hitting op limit. I find this hilarious XD The only thing is, if your script never uses some of the variables, they could safely assume it doesn't need to be in the script, and remove it. It would take a long time to figure out which variables are dummy variables after a map optimizer has changed all the names of the variables and whatnot.
 
Last edited:
Level 22
Joined
Feb 6, 2014
Messages
2,466
I'm thinking about changing my trigger that runs on Map Initialization to something that runs after x seconds have elapsed. Would this help?

Yes. If it still reaches op limit and if you have large arrays in Variable Manager (which are initialized in Map Init), then you can should manually define them at NOT in Map Init, maybe after 0.01 s.
To do that change the array size to default (Variable Manager) and in your 0.01 s elapsed time trigger, initialized your array's values using loops.
 
Level 13
Joined
Oct 18, 2013
Messages
690
Okay, well I changed everything that ran on init to an elapsed time event-- It still bugs :c
I don't really understand. I don't have an insane amount of variables. I deleted nearly all the triggers on a backup, and found that "fixed" the issue. I don't know what I can do to fix this without scrapping my map up, which is no solution xD I hit endglobals in my .j file at like 1890. (After running optimizers which took out comments, I hit endglobals at 1521)

Op limit is 2^13 (8192)..It doesn't seem like my globals block would exceed that. so what am I missing?
 
Last edited:
Level 13
Joined
Oct 18, 2013
Messages
690
That's a good suggestion. I keep most of my JASS in a separate map. However, I did check my map anyways for infinite loops and couldn't find any.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
That's a good suggestion. I keep most of my JASS in a separate map. However, I did check my map anyways for infinite loops and couldn't find any.

Well your problem is possibly caused by reaching op limit such that the triggers are no longer initialized.
Look at the test map

EDIT: If you would edit the trigger to be like this
JASS:
function Trig_Esc_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_001" )
endfunction

//===========================================================================
function InitTrig_Esc takes nothing returns nothing
    set gg_trg_Esc = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Esc, Player(0) )
    call TriggerAddAction( gg_trg_Esc, function Trig_Esc_Actions )
    call BJDebugMsg("Triggers initialized")
endfunction
You can observe that the debug message will not be displayed when op limit is reached meaning the triggers are not initialized.
 

Attachments

  • test.w3x
    20.3 KB · Views: 56
Level 13
Joined
Oct 18, 2013
Messages
690
Yes, hitting the op limit is likely the problem. What I'm wondering is, do globals being initialized contribute to hitting op limit? If so, I'm kinda surprised I've hit the op limit if my globals is only 1521 lines.

Edit: Btw, what causes the map to reach op limit in your test map? I'm confused.. I only see the trigger that runs when you tap esc.
 
Level 13
Joined
Oct 18, 2013
Messages
690
The game can handle over 20k globals, so 1500 shouldn't be a problem.
That's good to hear. Atleast I won't have to stress about cutting down on my globals when I fix this.
 
Level 13
Joined
Oct 18, 2013
Messages
690
oh. LOL Size of 8000.
So I'm assuming default array size of is like taking up 2 variables, correct? it would initialize 0 and 1 for default size?
As we established though, my globals block is only 1500 lines, and every array I have is at the default size :L
I really hope I can figure out what is causing this...


EDIT: A trigger running on init slipped by me. It had 21 lines of code, one including creating a hashtable. I'm not even going to pretend to understand how something that should be so simple tore my maps guts out and threw them on the floor. Welp :3 Thanks guys, finally found it xD

So does InitHashtable() run tons of code or something? It's just surprising it was able to cause op limit when I only had like 1.5k globals that needed to be initialized. Any word on that?
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
A trigger running on init slipped by me. It had 21 lines of code, one including creating a hashtable. I'm not even going to pretend to understand how something that should be so simple tore my maps guts out and threw them on the floor. Welp :3 Thanks guys, finally found it xD

So does InitHashtable() run tons of code or something? It's just surprising it was able to cause op limit when I only had like 1.5k globals that needed to be initialized. Any word on that?

Can you post exactly what you removed to fix it? I doubt that the InitHashtable is the cause.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
There are some actions that can not be done during map initialization, but I don't think this was the case here. Rather, by reducing the amount of stuff done during initialization you will inevitably fix the problem, but it doesn't mean that you've actually removed something expensive.
 
Level 13
Joined
Oct 18, 2013
Messages
690
Haha. It's from spells section. I figured hashtable would probably be creating the overhead. It also uses run trigger, which could quick add to the stuff going on in globals, albeit by a small amount.

  • Actions
    • Custom script: set udg_SP_Hashtable = InitHashtable()
      • set udg_SP_ItemType = 'I024'
    • Set SP_Value = 2.00
    • Trigger - Run SP Save <gen> (ignoring conditions)
      • set udg_SP_ItemType = 'I025'
    • Set SP_Value = 30.00
    • Trigger - Run SP Save <gen> (ignoring conditions)
      • set udg_SP_ItemType = 'I026'
    • Set SP_Value = 25.00
    • Trigger - Run SP Save <gen> (ignoring conditions)
    • Set PlayerColor[1] = |CFFFF0303
    • Set PlayerColor[2] = |CFF0042FF
    • Set PlayerColor[3] = |CFF1CB619
    • Set PlayerColor[4] = |CFF540081
    • Set PlayerColor[5] = |CFFFFFF01
    • Set PlayerColor[6] = |CFFFE8A0E
    • Set PlayerColor[7] = |CFF20C000
    • Set PlayerColor[8] = |CFFE55BB0
    • Set PlayerColor[9] = |CFF959697
    • Set PlayerColor[10] = |CFF7EBFF1
    • Set PlayerColor[11] = |CFF106246
    • Set PlayerColor[12] = |CFF4E2A04
This is the trigger that get ran by the above.
  • Actions
    • Custom script: set udg_SP_Key = udg_SP_ItemType
    • Hashtable - Save SP_Value as 0 of SP_Key in SP_Hashtable
So running the trigger is like 3 lines of code each time, I think, I don't necessarily understand how this caused it but oh well. It's fixed now so I can't complain.
 
Level 13
Joined
Oct 18, 2013
Messages
690
After I moved this single trigger, init ran fine. Idk if this somehow caused op limit to be reached or not. That's the only conclusion I can draw. Everything I did is above. I'll put this trigger back on init and see if it happens again!
 
Status
Not open for further replies.
Top