HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

vJass Various Unanswered Questions

03-18-2008, 02:30 AM#1
Salbrismind
I've recently made a transition to Jass but there is little I understand. What I need is a little help understanding certain concepts and such that I haven't really found out about from any tutorial.

1. What is a Scope? And how do I use them/ what is the proper syntax?

2. What is a library?

3. What is the difference between a private and a public function? When are the necessary? Couldn't I just use function?

4. What does it mean to use vJass? The way I understood it is using JassNewGen Map editor...

5. Where did everyone go to learn about these and other complex concepts? As well as where can I go to learn these things?

I probably have a few less important questions but I don't remember them. Having these things answered will make everything much easier, so thank you for just reading this, and thank you again if you can help me out.
03-18-2008, 02:58 AM#2
Rising_Dusk
All of your questions can be answered by reading the vjass tutorial thingy in the JassNewGenPack folder that you get when you unzip it in this folder:
Code:
\JassNewGen\jasshelper
Quote:
1. What is a Scope? And how do I use them/ what is the proper syntax?
A scope is used to give everything within the scope a prefix. This is especially useful for spell making and making things easy for people to modify (AKA submitted spells)
Expand Scope Sample:
You can also use the private keyword inside of a scope for global variables and functions to make them not be accessible elsewhere. In this case, if you looked at your .j file it would show "Rawr_MyFunct" as that function's name.
Quote:
2. What is a library?
Say you wanted to move all of some system's code to the top of your map's .j file so you could run the functions wherever you wanted in the map and not have to worry about it. You can use libraries to do that.
Expand Library Sample:
Libraries are more modular than scopes, but are used for different things. You can give libraries initializers (Things that initialize the library at map initialization), you can reorder them by demanding they 'require' other libraries, and so forth. The details can be found in the explanation file mentioned above.
Expand Extended Library Sample:
Quote:
3. What is the difference between a private and a public function? When are the necessary? Couldn't I just use function?
Private helps prevent collisions and basically helps protect you from yourself when coding. Public means the function is available for use outside of the scope (Meaning you can call it from somewhere else). In this vein, private members get their names randomized on compilation so you can't screw up and call them elsewhere, but public members do not (Meaning you can call them elsewhere).
Quote:
4. What does it mean to use vJass? The way I understood it is using JassNewGen Map editor...
Using any of the coding features made available to you in the Jass NewGen World editor is referred to as using vJass.
Quote:
5. Where did everyone go to learn about these and other complex concepts? As well as where can I go to learn these things?
The jasshelper manual I explained at the very top of this post.
03-18-2008, 03:07 AM#3
moyack
  1. Scope allows you to group and define functions and variables.
  2. A library is like a scope, but it allows to control dependencies among other libraries and put the code at the top of the map script.
  3. Private and Public can be applied to functions and variables. A private data is one that have a meaning inside a scope/library, so if you set a function or a variable private it can be called inside that library/scope but it will generate an error if it's called outside of such library/scope.
  4. If your map compiles properly in vanilla WE, the you're not using/ requiring vJASS, but if you use scopes, libraries, structs, several global declarations, textmacros or interfaces, then vJASS is used and JNGP is required.
  5. Go to the manual located into the JNGP folder, or go here
03-18-2008, 03:22 AM#4
Salbrismind
Thank you both. You both answered all my question perfectly to what I needed, and I have already begun reading the manual. I wish it was a bit easier to find though, except that I didn't really think there was a manual! Anyways I found it now and I will make myself as knowledgeable as possible with this new info, thank you!