| 02-25-2006, 12:55 AM | #1 |
Just learning to make maps fully in JASS, and I was wondering are there any such things as structs in JASS? I know in C there are and I'm sure in many other languages as well. If they were in JASS..it could make many of the things I want to do a lot easier. |
| 02-25-2006, 12:03 PM | #2 |
Well... Yeah there are. For exemple, the locations. You can define a variable of type "location", and this variable will contain x and y. But I don't know how to define a new struct in JASS, never done it ^^. Maybe is it like c. Anyway, just have a look at a website with JASS tutorials, you'll maybe get your answer :). |
| 02-25-2006, 12:08 PM | #3 |
There are no structs/objects/record. Its scripting language. location has x and y but it isn't location->x but GetLocationX(location) or whatever. |
| 02-25-2006, 12:09 PM | #4 |
Maybe is the method different, but if you can get x or y from ONE variable, my definition of this variable is a struct. But anyway, I'm sorry if I said wrong things :(. |
| 02-25-2006, 12:14 PM | #5 |
yes but you can't declare your structs. |
| 02-25-2006, 04:09 PM | #6 |
Didn't really expect to be able to but thought I'd make sure. Oh well, thanks for the answer. |
| 02-25-2006, 06:22 PM | #7 |
hmnn I would say that you can't have structs or objects in JASS. But you can mimic their behaviour JASS:// struct Astruct // { // int b; // int a; // unit x; // } //Create: local string S=NewTable() call SetTableInt(S,"b",200) call SetTableInt(S,"a",34) call SetTableObject(S,"x",GetTriggerUnit()) //Use function DoSomethingWithStruct takes string Astruct returns nothing if (GetTableInt(Astruct,"b")!=GetTableInt(Astruct,"a")) then call KillUnit(GetTableUnit(Astruct,"x")) endif endfunction |
| 02-25-2006, 06:29 PM | #8 |
Ah cool, that is what I need. |
