| 07-27-2008, 06:57 AM | #1 |
How? If now, we say, I got a struct, and I want the data in a function that I use for ForGroup, then what would I do? |
| 07-27-2008, 07:34 AM | #2 |
Pass the struct instance with a global variable. |
| 07-27-2008, 07:36 AM | #3 | |
Quote:
Yeah, but I don't understand those... |
| 07-27-2008, 07:41 AM | #4 |
JASS:struct structtype //... endstruct globals structtype TempStruct endglobals function TheForGroup takes nothing returns nothing //use TempStruct endfunction function SomeFunc takes nothing returns nothing //... set TempStruct = StructInstance call ForGroup(g, function TheForGroup) endfunction |
| 07-27-2008, 07:47 AM | #5 | |
Quote:
What is the StructInstance? And you don't have to have the global block below the structs. |
| 07-27-2008, 07:56 AM | #6 |
StructInstance is whatever struct instance you're using. |
| 07-27-2008, 08:00 AM | #7 |
I must have missed something, or else I'm just too tired, struct instance? |
| 07-27-2008, 08:03 AM | #8 |
You generally work with struct instances, unless you're just using static members? |
| 07-27-2008, 08:22 AM | #9 |
But then it won't be MUI? |
| 07-27-2008, 08:24 AM | #10 |
Gnerally it won't be MUI if your not using seperate struct instances to store your data, no. |
| 07-27-2008, 09:03 AM | #11 |
And that's the thing I understand how to. It's something with a global integer, right? |
| 07-27-2008, 10:43 AM | #12 | |
Quote:
And the struct instance is just JASS:local StructName dat1 = StructName.create () //for example //Could also be retrieving the struct from something rather than declaring a new one i.e. local StructName dat2 = GetTimerStructA (GetExpiredTimer ()) //or whatever system you use/handle you want to retrieve from |
| 07-27-2008, 12:24 PM | #13 | |
Quote:
|
| 07-27-2008, 12:57 PM | #14 |
You do not need structs for this. Just pass data into globals and then read this data from ForGroup call. Nothing can change your data before ForGroup finished (expect event generating actions, soo evoid using same globals everywhere) |
| 07-27-2008, 06:08 PM | #15 |
You can have a temporary global variable, you set it to whatever struct you are working with and then call the ForGroup. In the callback function you use this global variable. It will be MUI as long as the rest of the code is MUI because this global variable is used only while your trigger is running, and, unless you do something in the callback which might cause the same trigger to activate again (which you shouldn't do), your trigger have only one running instance at a time so it should be all right. |
