Newb, Quick few Qs

TheCrystal

New Member
Reaction score
36
So I just began to actually use JASS. I can do the basics, etc, except being new and being rather solo at the moment I've been unsure of what to do about a few things.

Firstly, what is a "private?"
Like I've seen (I tried to search ^_^) people do things such as "private real BLEH" etc, but have been unsure what "private" actually does.

Another thing, I wish to make an array to use in JASS, but I don't want to do "udg_LargeArray[X]" every time I call upon it.
So I'm assuming I can create variable in JASS as to bypass this "udg_LargeArray[X]".

And, how would I create it? Example please.

Edit: One more thing, is there an easy way without using/making a system to store data in a unit? I've heard of those systems like AIDS and PUI (I think) but have been unsure exactly what they do (Quickly read them)


Oh, one last newb question. How do I make an actual event for a JASS trigger? I can really only speculate and looking at a converted GUI to JASS is all too confusing.



Early thanks for helping this newb.
 

Exide

I am amazingly focused right now!
Reaction score
448
private, as I understand it, only works within the scope which it was declared.

You can create a global array variable the same way as a non-array variable. The only difference is that you cannot set it upon declaration.

Example:

JASS:

scope Name initializer Init

globals
    private integer array i    //global, array
    private integer n = 0     //gobal, non-array, set upon declaration
endglobals

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()

    set i[1] = 1
    set i[2] = 2
    set i[3] = 3
    set i[4] = 4
    //And so on..
endfunction

endscope


Creating events for vJASS triggers works in the same way as for JASS triggers.
I'm assuming you are using vJASS, since you mentioned 'private' at the start of your post.

Here's a Tutorial on vJASS:
http://www.thehelper.net/forums/showthread.php?t=125565
 

TheCrystal

New Member
Reaction score
36
Sorry for bumping, but I can either make a new topic or just bump this recent one (same post count, don't derep me! ^_^)

Anyways, I went through it and learned a few things, clarified others, etc. I've reread the "private" and "public" section several times and I still don't understand it real well, or at all. Scopes I'm a little confused on as well with their part on privates and publics. Can anyone clarify?

Edit: His example confused me (link'ed one)
 

Exide

I am amazingly focused right now!
Reaction score
448
You should've edited your last post, instead of double posting.

Anyway, private functions/variables/whatever can only be accessed within the scope which it was declared. (Meaning that you can create two or more scopes using the same global variable names, without them overwriting each other.)
Public can be accesed from other scopes, by using the name of the scope where the variable was declared + _ + the variable name.

From Romek's example:
JASS:

set Pub = 5         //Error - It's public
set Test_Pub = 5    //This is allowed. 'Test' is the scope that 'Pub' is within


I can't explain it better than Romek did in his Tutorial.
 

TheCrystal

New Member
Reaction score
36
Ah, I see. Some parts I'm confused on but I'm sure a night of sleep will help.

I did not edit because I don't think it "bolds" the topic name, and I would then get no replys. Sorry bout' that tho.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top