| 12-06-2006, 12:51 PM | #1 |
How do I create a global trackabel variable in jass, like you can in WEU? -thanks |
| 12-06-2006, 01:50 PM | #2 |
You need to edit the map script, to do this simply go to file -> export map script. Then open up the map script file in notepad or program of your choice. To add a global, put the variable somewhere after globals and before endglobals. Like so: JASS:globals gamecache udg_cache handle your_name trackable your_trackable endglobals And when you're done, you must import the map script back into your map. |
| 12-06-2006, 02:03 PM | #3 |
I have tryed that. It dosent work. ![]() |
| 12-06-2006, 02:51 PM | #4 |
wc3\UI This file adds trigger action you can edit it and add ANY type to GUI |
| 12-06-2006, 03:46 PM | #5 |
Thats to complicated for me Do you really need to edit so much to use global trackable? - there must be an easyer way. |
| 12-06-2006, 04:29 PM | #6 |
Theyre is no GUI function for trackables, so blizzard dident need to put trackables into the global list for GUI variables section. You dont need it global anyways, just use the return bug and a I2Trackable function. All you need is a global gamecache. Call it GC. (Create via GUI variable editor - Ctrl+x) Example: JASS:function GC takes nothing returns gamecache if(udg_GC==null)then call FlushGameCache(InitGameCache("GC")) set udg_GC=InitGameCache("GC") endif return udg_GC endfunction function H2I takes handle H returns integer return H return 0 endfunction function I2Trackable takes integer I returns trackable return I return null endfunction function SaveTrackable takes trackable t, string s returns nothing call StoreInteger(GC(), "trackables" , s, H2I(t)) endfunction function LoadTrackable takes string s returns trackable return I2Trackable(GetStoredInteger(GC(), "trackables", s)) endfunction I also added SaveTrackable and LoadTrackable, if you are familiar with Jass, you will know how to use them easily. Anyway, just to show: JASS:function Hi takes nothing returns nothing local trackable t = LoadTrackable("MyTrackable") // Do stuff endfunction function Bye takes nothing returns nothing local trackable t = CreateTrackable(...) call SaveTrackable(t, "MyTrackable") endfunction That will pass the trackable in function Bye into function Hi, pretty simple. Just paste the code i gave you at the top and put it into your main map script section and these 2 functions will be active. If your having trouble you know where to post :). |
| 12-06-2006, 04:30 PM | #7 |
Just use the global variable dialog or use vexorian's pre-processor. |
| 12-06-2006, 04:47 PM | #8 | |
Quote:
I see no Trackable in the GUI Variable editor, and Vexorian's preprocessor is alot for a small job. |
| 12-06-2006, 05:03 PM | #9 |
Generally, if you ever have the need to manage global trackables, it isn't going to be a "small job." Use Vex's preprocessor, you'll find it not only useful to be able to declare globals on the fly, but you'll find it useful in other ways as well. I believe this is the link to it. |
| 12-06-2006, 06:18 PM | #10 |
gamecache is a lot for a small job |
| 12-06-2006, 09:38 PM | #11 |
Thanks TideHunter |
| 12-07-2006, 10:10 PM | #12 |
What exactly are global trackables, I have never heard of them |
| 12-07-2006, 10:11 PM | #13 | |
Quote:
JASS:globals trackable t = null endglobals |
| 12-07-2006, 10:13 PM | #14 |
Oh i see its just a variable name, im an idiot ![]() |
