Warcraft 3 documentation
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[Jass 101] - Statements & Structure No New Posts Jass Tutorials

Started by
moyack

0 Members and 1 Guest are viewing this topic.

[Jass 101] - Statements & Structure
on: February 11, 2013, 09:31:10 PM

Remembering the previous tutorial we were ready to start coding. In fact we revealed what's inside those GUI blocks ans we saw they were just functions. Now it's time to understand the structure and how we should write.

When the code in the map is armed in the *.j file, it will condense the code in this way:

Code: jass
  1. //Global section
  2. globals
  3.  
  4.    //here you'll find all the global variables in the map
  5.  
  6. endglobals
  7. //End of the Global section
  8.  
  9. //Function section: here you will find all the functions that will manage the map.
  10. //...
  11.  
  12. function bla1 takes ... returns ...
  13.    // here will be a bunch of functions
  14. endfunction
  15.  
  16. function bla2 takes ... returns ...
  17.    // and more functions... :D
  18. endfunction
  19.  
  20. //... and more functions ... :)
  21.  
  22. function main takes nothing returns nothing
  23.    // Here's the main initial function
  24. endfunction

In JASS the function's order is very important in the sense that any function required by another function must be over the caller one. Here's an example:

IncorrectCorrect
Code: jass
  1. function Caller takes nothing returns nothing
  2.     // some code...
  3.     call Called()
  4.     // More code...
  5. endfunction
  6.  
  7. function Called takes nothing returns nothing
  8.     // Do some stuff...
  9. endfunction
Code: jass
  1. function Called takes nothing returns nothing
  2.     // Do some stuff...
  3. endfunction
  4.  
  5. function Caller takes nothing returns nothing
  6.     // some code...
  7.     call Called()
  8.     // More code...
  9. endfunction

to be continued...
« Last Edit: July 23, 2013, 08:03:03 AM by moyack »



[Jass 101] - Statements & Structure
Reply #1 on: February 14, 2013, 12:15:20 AM

Awww, please teach us more on the next tutorial. Or maybe me? lol

Chronicles of Darkness
by: SonofJay

A BlizzMod Hosted Project

They can hate, let them hate, make them hate.


[Jass 101] - Statements & Structure
Reply #2 on: February 14, 2013, 07:36:47 AM

I'm on it... this weekend I'll continue with this part.


 

Started by moyack

Replies: 1
Views: 29331
Jass Tutorials

Started by Vexorian

Replies: 0
Views: 2124
Codes & Snippets

Started by moyack

Replies: 2
Views: 6324
WC3 Editing Tools

Started by moyack

Replies: 3
Views: 4325
Jassdoc

Started by moyack

Replies: 225
Views: 318184
WC3 Editing Tools
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...