| 02-16-2007, 09:26 AM | #1 |
Is it possible in JASS to get the address of a variable ( either global or local ) like it does in C/C++ ? |
| 02-16-2007, 09:35 AM | #2 |
Not like in C/C++. However, we do have the return bug which we can use to get the address of a handle(unit, destructable, lightning, etc). Not the variable address unfortunately(unit[0] and unit[1] would return completely seperate address). The return bug works like this: JASS:function H2I takes handle h returns integer return h return 0 endfunction For practical applications of this, look for Kattanas' Handle Variables or Vexorians CS_Cache. |
| 02-16-2007, 12:32 PM | #3 |
Lame solution for non-native ones: JASS:struct pointer integer value endstruct function err takes nothing returns nothing local pointer p=pointer.create() local pointer x=p set p.value=56 call BJDebugMsg(I2S(x.value)) endfunction |
| 02-16-2007, 02:05 PM | #4 |
I got compile errors on this : JASS:struct pointer integer value endstruct Should I install anything before I can actually use structs on my naked WE ? |
| 02-16-2007, 08:28 PM | #5 |
wehelper edit: whoops, I meant jasshelper. sorry 'bout that. |
| 02-16-2007, 08:30 PM | #6 |
Grimoire + JASS helper. More debugging stuff, survives patches. Less a few things though. |
| 02-16-2007, 08:46 PM | #7 |
Nothing stops you from using wehelper on WE and grimoire on war3. |
| 02-17-2007, 03:03 PM | #8 |
Finally I got wehelper and jasshelper correctly installed on my WE. It works pretty well except that "Access violation" problem after I clicked "Browse Maps". BTW , my WE version is 1.20c ( 6052). Vex's struct works, but the address seems not the actual variable address, it's an index as I converted it to integer, something strange is each time I convert p to integer, it increased by 1, donno why, maybe I should check the compiled j file. Hmm.., I've realized maybe there has no way to get the real variable address. anyway, thanks guys. |
| 02-17-2007, 05:10 PM | #9 |
1.20c? You need to update your version of WC3 before going on, I think. |
| 02-17-2007, 05:20 PM | #10 | |
Quote:
Why wiould you want to do it anyway? |
