• 🏆 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!

[vJASS] Tell me more, About different Between Scope and Struct, Plz

Status
Not open for further replies.
Level 5
Joined
Jan 4, 2009
Messages
118
Tell me more, About different Between Scope and library Plz

I want to know how to use both statement. Sometime I ever see use struct for new trigger. It can be? And Scope When I use it?
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
A scope is a block of code which can have private and public members. Public members can be seen from anywhere in your code (well, anywhere below that scope) but must have the scope's name prefixed. Private members cannot be seen from outside the scope.

A scope can also have an initializer, which is a function called upon map initialization.

Structs are related to Object Oriented Programming and have more features than I care to list.

Both scopes and structs are documented in the vJass manual.
 

Cokemonkey11

Code Reviewer
Level 29
Joined
May 9, 2006
Messages
3,516
To answer your question more directly, vJass has included features to allow structs to have initializers, and some java programmers who use vJass prefer to handle all their triggers in structs.

That being said, this doesn't mean you should use structs to handle your triggers. Most vJass gurus will recommend scopes.

In PurplePoots link, I'd recommend starting here: http://www.wc3c.net/vexorian/jasshelpermanual.html#lib

Start with globals, libraries, and scopes, and much much later you can start reading about structs.

Good luck,
 
Status
Not open for further replies.
Top