• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Feedback] Lesson 1

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
Yea..

We have two types of variables.
Scalar Variables
Handle Variables

Wrong, it's

primitives vs types that extend off of handle


From here, we have
scalars
arrays
lists

etc, essentially

scalars vs collections

a string is actual a collection (an array of chars), making it a pointer (like a handle, although a handle is a *special* kind of pointer). Scalars are non arrays. An array of strings would actually be a 2D array, an array of arrays of chars (char* chars[] in c++).


Now, that's all I've read through the beginning of that lesson, but please fix your information =P.

Posting it in this forum so people can see this post while you are fixing it : )

edit
there is no character type variable, it's just an integer using a different number system..

the number systems in wc3 are decimal, octal, hexadecimal, and ascii. Ascii would be your 1/4 digit character.

edit
As for arrays, it's not that they start at 0, the array is a point to a sequence of information, like a sequence of integers.

[x][x][x][x][x][x]

that'd be an array of size 6, the [] representing the slots and the x representing the possible values stored within it.

The array itself is a pointer. The index adds to this pointer.

If we were to have this
[1][9][2][4][7][3]

Again, an array of size 6, but this time with 6 values, them being 1,9,2,4,7,3, just reading array would give back 1. In JASS, you can't treat an array as a pointer, you always have to use the index notation, which adds to the array pointer. Array[0] would give Array + 0, which is the array's very beginning (you aren't moving forward at all). At the start of the array is the value 1, so it would return 1.

If we wanted to get the second position, which has the value 9, we'd have to move forward by 1. Array + 1 as a pointer would give us the memory address at the value of 9. Array + 1 as a pointer == Array[1], which is once again 9.

So it's not that it starts counting at 0, that's bs. It starts counting at the array pointer : P.

However, I'm not sure how you would teach the above to beginners, hehehe

edit
it's not called variable referral, it's called reading/writing.

To read a variable, you'd just use the variable name. To write to it, you use the = operator. In JASS, this operator also requires the annoying set keyword.

edit
Also, please stop with the "it's incredibly simple," and "it's that easy." It almost sounds like you are insulting whoever is reading it, like... you're too stupid to understand this?? Look at how easy it is! Wow, how stupid can you be? Also, those lines add nothing to your lesson ;p.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
A primitive type is the simpliest type of variable supported by a language. This means that a Handle and a String are both primitives since they interface directly with the language. A Unit is not a primitive as it is a derivative of Handle.

You are confusing a pointer with a identifier with an absolute variable. However these do not mater as they are abstracted in the Jass interface anyway into primitive types that are easy to understand.

The type handle are implemented as identifiers. They store a number (a handle) that can be used by the game engine to resolve an element of the game state (such as a unit) to perform some sort of manipulation on. This can be considered an abstract reference since it does reference an abstract element in a system but does not do so directly (like a pointer does). Handles generally are meaningless by themselves as they are just a number that only means something if passed to the system that the element is contained in.

It is unclear how string is implemented in WC3. What I do know is it does reference some string in one of many duplicate string tables located throughout the WC3 process address space.

integer is a native type that acts prety much like a singed int does in most languages. It is a 4 byte structure with the range of -2^31 to 2^31-1. Overflows and division act exactly like they do in most programming languages. I advise looking up C or Java int type to understand it better.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
in JASS, we typically say that everything that isn't a handle is a primitive =), although handles are actually included in that list. We could rather say that everything that doesn't extend off of handle is a primitive (that'd be more accurate). Also, typically only scalars are primitives (like char vs string). As JASS doesn't have a char type the string would correctly be a primitive in this case, although it really isn't normally a primitive ;p.

the list of primitives would include
boolean
integer
real
code
handle
string

but a handle can still be a scalar ;o, so comparing handles to scalars is just silly, lol...

edit
I'll edit the start of my post ; P

edit
real is a native type that I do not know exactly how it works. What has been deduced is that real is a complex type consiting of an int for whole numbers and some other structure for the decimal component. This means that the range of acceptable real values is about that of an integer except with some decimal structure added to it on both ends. Unlike float types, the precission will not decrease with large numbers.

actually, reals are pretty much exactly like floats, and have the same issues as floats + the same big range : ).

edit
correct on handles, totally : D.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
forgot boolean lol...

If I recall a boolean is stored as an int. There are however many values of boolean beyond the standard 2 you except. This is why the one native (the one that returns if a unit is a certain type if I recall) gives problems if used in an efficent way as it returns a special boolean state that always evaluates false unless directly compared with true.

WC3 arrays are dynamic arrays similar to the ArrayList structure in Java. They expand in powers of two automaticly based on requirement with a default base size (not sure what). They have a limit of 2^13 elements. I do recall that there is a bug where the element at index 2^13-1 (final index) is not saved properly when saving a map and thus will break save games. Remember that like all arrays the first element is index 0.
 
Thank you for feedback Nes.

Nes said:
there is no character type variable, it's just an integer using a different number system..

the number systems in wc3 are decimal, octal, hexadecimal, and ascii. Ascii would be your 1/4 digit character.

I know. I Still provided the definition because I used the term 'character' in the "string" definition, and I'm not sure if everyone is aware of this term. (You can't be too sure)

As for the array explanation, yes. That's how they actually are, but explaining it that way for vJASS wouldn't be very intuitive D:

I used 'referral' because I don't want to confuse students with the terms 'read/write'.
I used very simple terms everywhere to ensure that everyone is going to get it, and I often introduced certain terminology so that they could catch up in future lessons.

Finally, you're right about the "It's super easy" spamming :V
 
Level 4
Joined
Jan 7, 2011
Messages
72
I'm sure Nestharus meant well with his OP, but as a complete JASS and programming newbie I understood none of it. That said, I am assuming it was aimed at Magtheridon rather than noobs like me who are participating in the JASS class.

By contrast, I completely understood Magtheridon's first lesson (thank you so much, Mag, for organising this class!)

The "super easy" comments didn't bother me, but I can see how someone much more experienced than myself (i.e. just about anyone) might find them insulting.
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,101
I'm sure Nestharus meant well with his OP, but as a complete JASS and programming newbie I understood none of it. That said, I am assuming it was aimed at Magtheridon rather than noobs like me who are participating in the JASS class.

By contrast, I completely understood Magtheridon's first lesson (thank you so much, Mag, for organising this class!)

The "super easy" comments didn't bother me, but I can see how someone much more experienced than myself (i.e. just about anyone) might find them insulting.

I am sure Mag understands the review by Nes and if there was something you were unsure of, you could read the lesson again after Mag has applied the changes he finds are needed. I think that Nes pays much attention to tiny details which is a good thing, but not necessarily of much importance for us to learn. :)
 
Instead of making difference is variable simple or not, you should focus doing next:
- List all jass variables.
- List all GUI variables and show users how are they linked with jass ones.
- Explain memory usage and array size.
- Explain variable default state.
- Explain difference between local, private global, global and udg_global variables.
- Explain constant, readonly, static... variables.
- Explain some variables initialization state (hashtables at first place, but = CreateGroup() and such will cover this just fine).

Maybe few other things I just can't remember all.
Don't get me wrong I don't care about programming in general I care about wc3 modding.
All this knowledge above is required almost for any function, spell, system, you make.

Please think about it.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,266
- List all GUI variables and show users how are they linked with jass ones.

That would help people like me, which only understands GUI mostly.

Perhaps a list all jass variables/functions would scare us off. We are not ready for that yet...


If you only use texts without pictures it gets boring reading it, its french for me... no its more like greek! For me its like you teach french (Jass) using french words only, and greek (vJass) I don't understand at all, cuz I only understand English (GUI)
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
you must have JNGP
the sad thing about it is that every time you want to test things in vJass you must recompile it, in other words save the map
there are funcrions for printong strings to the monitor but Im sure mag(or nestharus?) will go into that later
 
Level 5
Joined
Oct 13, 2010
Messages
84
Maybe you
- missed the newest jasshelper . Download here
- you made the errors at somewhere then jasshelper can't compile it correct. Post your map for experience man checks it
- Do you switch your War3 to 1.24e (recommended) or a newer version?

Er, seem Jass class don't have required enviroment to learn properly.........
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
Things should be simplified for the very basics of how a programming language works to be understandable. That is the problem of most people modding wc3 because they are mostly in their early teens and have no experience in any sort of coding yet. If you go around speaking of primitive types, non-primitive types and what significance that has in the large anatomy and physiology of a computer, you'll just get everyone confused.
 
The problem with teaching people to program is that teaching them the easy way gives them incorrect and incomplete information often because we'd be making far too many abstractions, and that's going to bite them in the buttocks some day. It's a very delicate process and we must be careful with the way things are represented/brought up :/

A box that holds values is a fine analogy, but when we bring up variable shadowing, it breaks :(
It also makes things confusing when trying to explain how uninitialized variable reads stop the thread because uninitialized and null would be the same thing in this analogy, and null reads do not stop the thread.

You can think of a variable as a box that holds values, but you can't rely on that analogy to explain the details.
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
For many people, this is their first programming language. If you just teach the syntax, they are going to be rather lost : \. It's best to assume that the person has had 0 programming experience. With this assumption, general programming should be taught alongside vjass so that they understand what the syntax is, like a function, not just how to write one.

You could easily say

This is a function
JASS:
function hi takes nothing returns nothing
endfunction

nothing in arguments can be replaced by an argument list
integer i, integer k, integer v

or just a single value

the nothing for return can be replaced by a type


To call it, use the call keyword -> call hi()

The ( ) holds a list of values, given that the function takes arguments.



Have fun



For someone with programming experience, that is a perfectly good explanation. For someone with 0 programming experience, they won't even know what a function is.

You need to consider your audience. This class was aimed at GUI people, meaning that they have likely never programmed before.
 
Level 6
Joined
Jan 7, 2010
Messages
258
did the 1st week, starting 2nd week soon. Helped me alot and i finally can start learning Jass, anyway it will take months to write some goode codes.

Thanks
 
Level 10
Joined
Dec 15, 2012
Messages
650
I saw this in Lesson 1 practice 3
JASS:
integer integer
the second "integer" is in red color so I have changed it to
JASS:
integer Integer
Am i doing something useless or (...) I don't know what is vJass/Jass and I'm hard to understand them. Pls reply, I'm new to Jass.
What am I needed to know --> Am i done it in the right way ? :/
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
First word is the type
Second word is the name

All types are reserved keywords, so they may not be used as names.

A name is how you access that variable, it is the identifier. The type is what it stores.

The integer type stores whole numbers. By having integer integer, a whole number is being stored into a variable called integer. By having integer Integer, a whole number is being stored into a variable called Integer.

The first will not work for plain global variables as type names are reserved.
 
Last edited by a moderator:
Status
Not open for further replies.
Top