• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] IF-statement with custom script

Status
Not open for further replies.
Level 4
Joined
Dec 25, 2012
Messages
66
Is it possible? Most tutorial dealing with custom scripts only use them for "call functionName()"
 
Level 4
Joined
Dec 25, 2012
Messages
66
Thx, very useful. It is strange that none of "Custom script" tutorials explain IF-THEN_ELSE use...
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
If statements are available in GUI without custom scripts.
Custom functions, Common.j functions, easier string concatenation and number calculations, etc are not. That is what you will see in those custom script tutorials. (Ofcourse next to JASS syntax, global variable usage and all the other stuff you need to know.)
 
Level 4
Joined
Dec 25, 2012
Messages
66
If statements are available in GUI without custom scripts.
Custom functions, Common.j functions, easier string concatenation and number calculations, etc are not. That is what you will see in those custom script tutorials. (Ofcourse next to JASS syntax, global variable usage and all the other stuff you need to know.)

There are, indeed, GUI-based IF-statements. The problem is, they cannot directly access local variables. There is a workaround, but it's bulky (reassigning local variable value to global). I just needed to quickly compare two locals I and J, if equal, set K to 1. Not enough to warrant rewriting trigger in jass, one line of custom code IF should be enough.
 
Level 4
Joined
Dec 25, 2012
Messages
66
Hm, I still get "End of line expected" whenever I try to use IF-statement in custom script. Example:

Custom script: If i==j then set k=1 endif

Results in an "Expected end of line" error
 
Last edited:
Status
Not open for further replies.
Top