HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Destroying All Triggers

04-28-2004, 12:17 AM#1
Xinlitik
Is there a way to destroy all of a map triggers, other than using call DestroyTrigger() a thousand times?

I'm hoping yes.... I think it would help reduce the lag for garbage pickup at the end of the game.

Thanks
04-28-2004, 12:20 AM#2
Vexorian
No, there isn't , and I beat it has to do with another type actually, like points, effects, rects and all that stuff

aNd actually all the time it takes is because it is destroying everything
04-28-2004, 12:23 AM#3
QuatreDan
Maybe you could put an asterisk "*" ? Lol, sorry, it's only a suggestion. I know that that works for formating a hard drive, though. =P

EDIT: Well, I have an idea, but you may not like it. If you change the names of all of your triggers to numbers, then you could do a For...Loop, right? Once again, only a thought. Good luck.
04-28-2004, 12:42 AM#4
johnfn
Quote:
Originally Posted by QuatreDan
EDIT: Well, I have an idea, but you may not like it. If you change the names of all of your triggers to numbers, then you could do a For...Loop, right? Once again, only a thought. Good luck.

I dont think that'll work, there's no conversion from trigger name to string, and even then...
Like vex said, doing what your doing now is going to be the same as end-of-game lag, so i suppose it doesnt matter.

(other then posting the above, the other reason I posted is to say, QuatreDan, your sig rocks. "life sucks, then you die". I like it!)
04-28-2004, 02:06 AM#5
Xinlitik
The last 60 seconds of my game (after one side has achieved victory) is the "chat time" where I want to destroy the triggers.

Quote:
I beat it has to do with another type actually, like points, effects, rects
I actually have a pretty darn good (for an AoS...at least) cleanup time afterwards. A 45+ minute game clocks about 9 seconds. I clean up all my effects points etc, but the game leaks on its own, like every other program...so I wanted to see if I could cut it down more by destroying triggers. Apparently I cant, so oh well. Thx for the help guys.
04-28-2004, 02:55 AM#6
QuatreDan
Quote:
Originally Posted by johnfn
I dont think that'll work, there's no conversion from trigger name to string, and even then...
Like vex said, doing what your doing now is going to be the same as end-of-game lag, so i suppose it doesnt matter.

(other then posting the above, the other reason I posted is to say, QuatreDan, your sig rocks. "life sucks, then you die". I like it!)

No no, I meant like physically change the name of all of his triggers to numbers, not in-game, in the editor. Then could you use it?

And, yes, a friend told that to me once, and I fell in love. :D
04-28-2004, 03:19 AM#7
weaaddar
well heres me talking out of my ass, but I believe all triggers will be assigned to consecutive handle numbers so technically you could find the address of the first trigger and then do a for loop from 1 to number of triggers and then using the return bug typecast the integer to a trigger. This is untested, and probably not the best way to do it.
04-28-2004, 03:36 AM#8
Narwanza
Quote:
I actually have a pretty darn good (for an AoS...at least) cleanup time afterwards. A 45+ minute game clocks about 9 seconds. I clean up all my effects points etc, but the game leaks on its own, like every other program...so I wanted to see if I could cut it down more by destroying triggers. Apparently I cant, so oh well. Thx for the help guys.

9 seconds!! Thats absurd. My TD after an hour and 30 mins with 8 people playing clocks nothing.(its shorter now ;)) I'm serious, it quits instantly. So don't be bashin blizzard about leakin, because they don't. Weaaddar, that would be dangerous, and as you said untested. Now, it might work very well, but you would have to remeber also. He has to have 1 trigger left to make everyone exit, and how would he know which address it would be assigned. I agree that it might work, but you might as well let blizzard do the garbage cleanup if you plan to do something like that. So, what I am basically saying is that you can cut that down more, but it definitly ain't your triggers slowing you down. Make sure that every unit created is exploded on death (helps memory leak alot) and also make sure you remove Every region, and location created on the spot. Those are horrible if you are using GUI. Oh, and make sure to destroy all Group variables in your map. If you are using JASS make sure to dereference all locals at the end of functions, and destroy unnecessary triggers that are created on the fly. Good luck, making clean code is harder than making an elephant walk backwards.
04-28-2004, 05:01 AM#9
Xinlitik
Quote:
So don't be bashin blizzard about leakin, because they don't.
Not bashing blizzard :). Everything leaks...record your memory usage before a program then after a program...it will be bigger I guarantee it.

I dont know what kind of stuff your TD has but this map has about 72 trigger-made spells, spawns every 70 seconds, buildings that are recreated frequently, et cetera.

I do remove all locations. I do remove all unit groups. I remove/explode a lot of units but most are timed life. I use Hivespawn that recycles most units. Most of the leaks are from the units created when not enough units die. And 9 seconds is good for an AoS...just about every one I've played is like 20-40 seconds. I've even had the game crash from one game cause it leaked so much. I dont write in JASS so, of course, I cant clean everything, but I try. This trigger destroy stuff is just another thing I want to try.

Weaddarr... any idea how I could do that? hehe
04-28-2004, 06:47 PM#10
weaaddar
I realized a problem with that, you create more handles then just triggers. You make actions, events, and condition objects as well. So your best bet would be to put all triggers into an array and then just iterate through and destroy them.
04-28-2004, 08:29 PM#11
ThyFlame
Quote:
Originally Posted by Narwanza
Good luck, making clean code is harder than making an elephant walk backwards.

Offtopic, but eh? An elephant can't walk backwards?
04-29-2004, 08:24 PM#12
Vexorian
bah, just destroy the triggers when you don't need them, and actually, you can't do a mass destroy during a chat moment (unless it is a non computer related chat) because the comp will freeze anyways.

Now that I think of it, you can have an array with all the triggers then destroy first one, wait 0 seconds, destroy next one , ....
04-29-2004, 08:50 PM#13
Deathperception
Also a quicker way to destroy triggers in the Worldeditor is to use WEU it has added the functionality to destroy individual triggers using the world editor GUI it may be faster then entering it manually.