Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: [Jass 101] - Statements & Structure  (Read 9220 times)

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 980
  • WC3 Models: 5
  • WC3 Tutorials: 11
  • WC3 Tools: 10
  • WC3 Maps: 11
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 4
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
[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  [Select]
  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  [Select]
  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  [Select]
  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 »

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

  • Your Awesome Site Director
  • Recognized User
  • Starter - level 1
  • *
  • Posts: 382
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • Reputation: 677
    • View Profile
[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.

  • Site Owner
  • Administrator
  • Starter - level 4
  • *
  • Posts: 980
  • WC3 Models: 5
  • WC3 Tutorials: 11
  • WC3 Tools: 10
  • WC3 Maps: 11
  • WC3 Skins: 6
  • WC3 Icons: 2
  • WC3 Spells: 4
  • Reputation: 1153
  • Site Admin - I love fix things
    • View Profile
    • Blizzard Modding Information Center
[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.

We can give you full hosting for your projects, a complete page!!

A custom altered melee map where you can play Naga and Demons. Check it out!!
Use Dropbox...

 

The Jass NewGen Pack (JNGP) 2.0 vs Warcraft III's patch 1.27a

Started by ApelliBoard General Help and WC3 Discussion

Replies: 9
Views: 4733
Last post March 21, 2016, 06:32:55 AM
by LembidiZ
Jass Newgen Pack 2.0 Alpha - Recruiting for testing

Started by moyackBoard General Help and WC3 Discussion

Replies: 84
Views: 44061
Last post July 17, 2013, 09:37:47 AM
by moyack
What's the best jass preprocessor? pjass or zoxc jassparser?

Started by moyackBoard Jass Theory & Questions

Replies: 2
Views: 8294
Last post December 14, 2012, 02:58:27 PM
by moyack
The Jass NewGen Pack (JNGP) 2.0

Started by moyackBoard WC3 Editing Tools

Replies: 210
Views: 179193
Last post April 11, 2017, 03:58:16 PM
by moyack
Jass NewGen Pack Update

Started by PurgeandfireBoard General Jass Discussion

Replies: 4
Views: 11805
Last post July 29, 2012, 03:28:05 PM
by Purgeandfire
Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!