G_MAX_SCRIPT_STACK_ITEMS


(Chruker) #1

Hi

I just banged my head against this error today, so I thought I would warn you other script monkeys out there about it.

The error was G_MAX_SCRIPT_STACK_ITEMS and from what I can tell it happens because there are two many trigger / event routines inside a scriptblock. The limit is 196.

After I reduced the number of routines in a scriptblock the map I’m making loaded correctly.

I then copied a large portion of the routines (70 to be exact) into 3 other scriptblocks. The map still loaded correctly, so this isn’t the limit for the entire script file.

Any comments are welcome.


(Chruker) #2

What I was attempting to do, was timing a race and then check the time it took against a record time.


(MadJack) #3

That’s nice to know! :slight_smile: Though I don’t think (and hope) I’ll hit 196 items in a single script block! :eek2: :wink:


(Chruker) #4

Hi

I just checked and in the tank scriptblock of the fueldump script the triggers for the different tank positions along its route are 134. And suddenly the limit is a lot closer.

Keeping in mind the limit number of spline points - used for the route - is 512 per map.


(Yatta_Yatta-O_o) #5

Im unburrying this 1 and half year old post, In the hope someone can give an answer …
Since the limit requires to move excessive trigger routines into other blocks, how do you get your tank working in this conditions ?

Simplified ex :


tank_mover
{
	trigger go
	{
		globalaccum 1 trigger_if_equal 0 tank_script step_01
		globalaccum 1 trigger_if_equal 1 tank_script step_02
		...
		globalaccum 1 trigger_if_equal 100 tank_script step_101
		trigger tank_mover_overflow go
	}

	trigger step_01 {
		globalaccum 1 inc 1
		followspline whatever
	}
	trigger step_02 {
		globalaccum 1 inc 1
		followspline whatever
	}

	...
	trigger step_101 {
		globalaccum 1 inc 1
		followspline whatever
	}
}

tank_mover_overflow
{
	trigger go
	{
		globalaccum 1 trigger_if_equal 101 tank_script step_102
		globalaccum 1 trigger_if_equal 102 tank_script step_103
		...
	}

	trigger step_102 {
		globalaccum 1 inc 1
		followspline whatever
	}
	trigger step_103 {
		globalaccum 1 inc 1
		followspline whatever
	}

	...
}

so the tank_mover script is alright, but in the tank_mover_overflow script, the followspline doesnt apply to the tank_mover, but to nothing … so how do you continue moving the tank ? Is there another solution than to make a second tank and replace the first one with it when you change script chapters ? (what will happen to the player using the tank mg ?)


(]UBC[ McNite) #6

He ll probably die sniggers insanely

Anyways, you could make the tank run into a mine barrier/ mortar fire, so it will be disabled, no player at the mg, and then exchanging tank1 for tank2 won’t hurt anybody.


(Yatta_Yatta-O_o) #7

Well heres the result of numerous tests & tweakings …
As there didnt seem to be much other solutions, I decided to go with the tank clone trick.
Altough I had to do quite some scripts rearrengements (actually Ill have 3 tanks cuz I really have a long way =P …).
It worked fine, except for the MG : playing the map, regardless of wich tank I used I ended on the first tank MG.
After checking & rechecking tagetnames/scriptnames, tweaking stuff and searching the forum, I learned something : It is impossible to have two vehicules in a map with mounted gun at once, because the game use the tag_turret to fix the mg42 on. If you have two tanks, both will have a tag name “tag_turret”, and the game will place the player on the first “tag_turret” it’ll found in his list, (altough all movers can display the attached gun correctly).
However, If having more than one tank at once having mounted_gun wasnt possible, having more than one having guns at separate times should be possible :
I decided to try to move the attach the tank body (wich the gun was attached to) to the next tank, and surprise, it worked perfectly fine … until … !!
When doing a map_restart, the first tank didnt have his ‘body’, just the tracks.

Runing map the first time : first tank fine
Switching to second tank : fine
What if player is on the mg at the switching point : no problem, the player is still at the mg, doesnt notice anything and can detach
Then, map_restart : first tank screwed

This was the last thing to correct, but altough Ive tried everything I could, I just managed to mess up my script, resulting in the tank turret (the canon, not the mg) not showing up anymore on the second tank when switching, could not correct the map_restart messed up tank bug, and could not revert to the “almost good” situation where everything was fine before the map_restart.

Therefore Ive gave up on this problem, and choosed the no mounted gun option. Players might get frustrated not having their toy, but hey, Ive spent half a day on this, you cant say I didnt try @_@.


(]UBC[ McNite) #8

How huge is your map? I mean, if you need 3 tanks… make it a tank route that is 3 times fueldump… I really wonder whether that is going to give you enjoyable gameplay. Escorting the tank on fueldump already can be a LONG journey.


(Yatta_Yatta-O_o) #9

theres quite some work to do along the way (objectives captures, destroying, building, activating switchs, moving stuff …) so yes a game on this map should be quite long. Im trying my best to keep the players busy and not just “push the tank arround”. The part im working on actually is quite big, and I still have to improves some intermediates zones that are quite too “flat” in gameplay, but the hotspots seems reasonably interesting to me, with various kind of fights (large/medium outdoor fights, “city” fights (Ã la oasis), interior/corridor fights … ).
However, about the duration of the game, Im already thinking of doing 3 ‘standalone’ versions for the release : Full map, 1st Half, 2nd Half. The style difference between the two halves makes a split acceptable i think.
Talking about that I think ill make a map presentation topic soon =)