| 05-16-2006, 07:04 PM | #2 |
use trigger tags for GUI |
| 05-16-2006, 07:22 PM | #3 |
Wait, wait, wait. No that fast. So... Blade edited my post, I got this now. But what is with that what Vexorian wrote? Did he use JASS in his further trigger or GUI? Now I'm confused. I use setting up locals in the beginning of my trigger, so that these variables can't change their values (by running the trigger a 2nd time while the run from the 1st time still lasts). And setting up the locals refering to the global ones (the udgs) has what effect? It lets you completely remove the local variables by refering to them later in the trigger so that there aren't created any memory leaks, right? Is that the sense of making the locals refer to globals (udg)? And if this is right, what I hope, then I always have to refer with "udg_" before the respectively name of the variable (if I want to use JASS and if the variable is set up as a local refering to a global)? |
| 05-16-2006, 08:22 PM | #4 | |
Quote:
The sense is that it uses a global, and can thus be used in GUI. If you are competant in JASS, it is better to use locals. |
| 05-16-2006, 08:52 PM | #5 | |
Ahh, now I understand, so that is why the tutorial from Vexorian is called "local variables for everyone", hehe, for people who uses GUI! Quote:
So in these rare situations I could use a local variable refering to a global variable so that I can detect it later and remove it? Or does the global variables generally also leave some indexes when I remove them...? Ahhh, what was the problem again using local variables in JASS? Sorry, but can you perhaps explain the pros and contras using locals in JASS and Globals(udg) in GUI? |
| 05-16-2006, 09:44 PM | #6 |
I doubt the local variable 'refers' to the global variable. It just makes it "legal" according to the GUI, since the var actually does exist. + You can create locals "on the fly" Locals are unique to the function being run, which makes it easy to create MUI abilities/triggers Also less of a hassle using them (don't need to go the global var list and add them, you can just write whatever you want) - Locals (handles only) need to be nulled I'm sure there's more, but I'm no expert :) I only use two globals myself, udg_cache and udg_multiboard ![]() |
| 05-16-2006, 10:25 PM | #7 | |
Quote:
Lucky u ;) |
| 05-17-2006, 05:11 AM | #8 | |
Quote:
So, through setting a global var to a local var with custom script (I mean: local <variable> udg_name), you can use the var in GUI and it works like a local (locals values will not be replaced if their trigger runs several times at the same moment)? That is the sense of using it? That’s it? |
| 05-17-2006, 05:16 AM | #9 |
Yes, but AFAIK, you can't use the trick on multiple variables in the same trigger, I think they then will save to the same place in the memory overwriting each other. |
| 05-17-2006, 05:21 AM | #10 | ||
Quote:
1) Ah, good, finally I got it. 2) What do you mean by saying "AFAIK"? I found this in another thread, for clearing up what are handle locals: Quote:
So is this right? This sort of var I don't have to nullify? |
| 05-17-2006, 05:24 AM | #11 |
http://www.urbandictionary.com/define.php?term=AFAIK Yes, you don't need to set variables of the those types to null. |
| 05-17-2006, 05:51 AM | #12 | |
Quote:
|
| 05-17-2006, 12:56 PM | #13 |
Last 2 questions: In the beginning of the thread I asked about texttag. When I use them in JASS for locals ("local texttag name"), and then remove them ( call SetTextTagPermanentBJ(name, false) ) ( call SetTextTagLifespanBJ(name, 2.50) ) do I also have to set them to null? I mean is it a string type or is it a handle var? And as you can see here in: call SetTextTagLifespanBJ(name, 2.50) there is a BJ! What does this mean/ do? I heared it is better to use functions without BJ, but what do I have to do then, always just remove the BJ from the function? JASS is case-sensitive, I'm very distrustfully whether just removing the BJ will work... EDIT1: I searched a bit and found that functions with BJ in it are from Blizzard.j. These functions should be avoided, because they take bits of memory hostage. BUT how do I avoid them? Is anywhere a list that says what I have to use instead of those Blizzard.j - functions which I generally get when converting from GUI to JASS? Would be really helpful... Edit2: I found Magnus99's reference manual at: http://jass.sourceforge.net/doc/api/...-texttag.shtml There are written very many functions in the API-Browser. There are also listed functions from Blizzard.j and common.j! So, should I prefer the functions from common.j or what? Example: Blizzard.j: function SetTextTagPermanentBJ (texttag tt, boolean flag) Common.j: native SetTextTagPermanent (texttag t, boolean flag) What is the difference using these two functions? Should I prefer one? And here? 1) native CreateTextTag () returns texttag 2) function CreateTextTagLocBJ (string s, location loc, real zOffset, real size, real red, real green, real blue, real transparency) returns texttag I can not use the first one or? At least I want to have a texttag at a location (a units position)... Come on, please help... ![]() EDIT 18.05.06:If I write it that way, is it ok then? JASS:call CreateTextTagLocBJ((("any text"), udg_Temp_Punkt_Array[14], 0.00, 10.00, 100, 100, 100, 0) JASS:call RemoveLocation (udg_Temp_Punkt_Array[14]) Is this the best and perfect way I can do that? EDIT: SHOULD I OPEN A NEW THREAD??? |
