| 06-25-2004, 09:32 PM | #1 |
Is there a way to declare a global variable of type triggeraction. I have code that creates and destroys triggers during game and I want to remove the memory leak from the actions part of the trigger. |
| 06-26-2004, 12:22 AM | #2 |
no use the return bug and arrays or gamecache to store triggeractions |
| 06-26-2004, 04:38 AM | #3 |
How could you use those to store trigger actions other than strings and executefunc |
| 06-26-2004, 03:57 PM | #4 |
The return bug allows you to store variables of type triggeraction in any variable, regardless of its type. So you can have an integer global that then contains this triggeraction. And in case you do not know what a triggeraction is, it is what TriggerAddAction returns. The only use of it is to destroy the trigger action. |
| 06-26-2004, 05:23 PM | #5 |
triggeraction and some other advanced types are also available in the variables menu if you use UMSWE or WEU. |
| 06-27-2004, 03:24 AM | #6 |
PM since your whoring your project I'd like to ask a question is there anyway you can add a write a function line in gui (and perferably a way to call that function outside of the custom script). Right now the onyl way I do it is I use the unit group hack to create the function. |
| 06-27-2004, 02:17 PM | #7 |
ahh ok thx |
| 06-27-2004, 07:46 PM | #8 | |
Quote:
Unit group hack? I'm not really sure what you mean weaddar, can you explain? |
| 06-28-2004, 12:33 PM | #9 |
Pitzer, He can use (abuse) the "Pick each unit in <group>" GUI action to create a new function above the main function of a trigger. Becouse when one uses PickEachUnitInGroup, all it's statements get put in a function at the top of the trigger-area. So he can put something like this inside the PickEach statement: Code:
PickEach .... Custom Script: endfunction Custom Script: function ExterminateUnit takes unit returns nothing Custom Script: call KillUnit(unit) Custom Script: call RemoveUnit(unit) Custom Script: call ExterminateUnit( udg_TempUnit ) It's kinda wacky, but he's wondering if there are other ways to insert lines of GUI outside of the main function. ~Cubasis |
| 06-28-2004, 01:11 PM | #10 |
Interesting way of doing this, although I don't see why you wouldn't simply declare it as a header function. Anyway I don't see any other way of doing it. But there used to be that commenting out trick which allowed you to use functions declared in other triggers, but I guess that's not what he needs. I'm wondering if it still works. |
