• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[vJASS] Instance referal

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
Thanks. One more thing - how to retrieve an instance's index?
I thought that the actual instance is an integer representing the index, but when i tried, in a method, to do: if this == SomeInteger then it gave an error saying that 2 different values can't be compared.
However, if i make a debug message BJDebugMsg(I2S(InstanceName)) it shows it's index.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
integer(this) == SomeInteger
There's no integer() function :X
if this == structName(SomeInteger)
That would mean comparing 2 struct intances. I want to compare a struct instance's index with an integer.
Good idea, but still it showed the same error.

EDIT: Found a way. Setting an integer variable to 'this' and then comparing the variable and SomeInteger worked.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
integer() is supposed to ask jasshelper consider the instance struct argument as in integer, it's not a jass function, it's a vJass feature.

So that should work, never tried though, maybe the parser doesn't allow it without using an intermediate integer variable like you did, which would be silly because we all know that in vJass a struct instance is an integer.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
integer() is supposed to ask jasshelper consider the instance struct argument as in integer, it's not a jass function, it's a vJass feature.

So that should work, never tried though, maybe the parser doesn't allow it without using an intermediate integer variable like you did, which would be silly because we all know that in vJass a struct instance is an integer.
Oh, it worked ;O
Sry i didn't test it at first.
Thanks.
 
Status
Not open for further replies.
Top