• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Jass loc.getX()

Status
Not open for further replies.
Level 4
Joined
Aug 18, 2013
Messages
71
Title explains what I'm trying to do. I'm very used to objects in C++ and Java, and jass doesn't have the functionality i'm trying to achieve. Can anyone explain to me how to do what i'm trying to achieve, and point me to a tutorial for struggling programmers trying to relearn syntax.

if you're unfamiliar with coding languages outside of jass, c++ and java an a nifty functionality with objects where you can access "public" variables from the object. For example

init an object
Code:
public object o
public o
{
int x;
int y;
}

getX()
{
return x;
}

getY()
{
return y;
}

... etc

now in a main function
Code:
object o = new object();
o.x = 2;
exampleInt = 0.getX();
exampleReal would be equal to 2

This is just an quick example, many things are missing for this to be completely functional.

 
I'm sure Purge can point you to a better guide, but this is what I used back then:
wc3c vjass has a documentation bundled with jasshelper.
 
If you're used to Java, you could try out Wurst language linked in my signature. It has a very similar syntax, much better than vJass' plus allows a more organized and modular code.

If you want to use vJass, just declare an object and its members, they're public by default.
JASS:
struct O
    integer x
    integer y

    method getX takes nothing returns integer
        return x
    endmethod

    method getY takes nothing returns integer
        return y
    endmethod
endstruct
JASS:
local O o = O.create()
set o.x = 2
set exampleInt = o.x
 
Status
Not open for further replies.
Back
Top