| 10-06-2009, 05:13 AM | #1 | |
Hi, ok so i have learned realy basic jass about an hour ago, and decided to make my GUI spell MUI. I came up with this:
The problem is, at line 60: call ForGroupBJ( GetUnitsInRangeOfLocAll(512, Apocalyptica_Temp_Point),function Trig1(Apocalyptica_Temp_Caster)) He says: Expected ' I have no idea what it means, can anyone help me? |
| 10-06-2009, 05:30 AM | #2 |
in jass, callback functions, like the one you specify to ForGroupBJ, can not receive parameters, they must takes nothing, so the right way to use the ForGroupBJ is writing only the name of the callback functions, whithout any parameter, adjusting the function prototype that is being called: call ForGroup( GetUnitsInRangeOfLocAll(512, Apocalyptica_Temp_Point), function Trig1 ) //replaced ForGroupBJ with ForGroup |
| 10-06-2009, 05:39 AM | #3 |
The thing is i need to get that parameters to work, since i use a unit and a real number wich is declared at the very first of the trigger, and i can't declare it again since after that wait period things can be changed, so how can i get this to work? |
| 10-06-2009, 06:23 AM | #4 | |
Quote:
with a global variable it should work set the global = <what you give your func> before calling ForGroup or ForGroupBJ and use it in the called func after everything is done, you can remove your global (calling either destroy or setting it = null |
| 10-07-2009, 04:06 AM | #5 |
You could do it this way. Declare a struct: JASS:struct s_name unit tempUnit1 = null unit tempUnit2 = null real tempReal1 real tempReal2 //* Any data-types you may need can be declared in this struct, which will be saved to the //* Group handle as an integer; endstruct Next, initialize a hashtable and use it to store the value of the struct to the necessary group. JASS:// ... set hash = InitHashtable() // ... call SaveInteger( hash, GetHandleId(yourGroup), 1, nameStruct ) //* youGroup would be the group you are attaching the values to, and nameStruct would be // ... //* a reference to an instance of s_name. Once you are done with the data (after the ForGroup) you will need to use the RemoveSavedInteger( hash, GetHandleId(youGroup), 1 ) for cleanup. I still don't know how necessary this is but I don't like leaving it to chance. For something like this, it is probably more efficient in general to use globals, but there are some situations where globals may not cut it. |
