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

[JASS] Need Help with jass

Status
Not open for further replies.
Level 4
Joined
Jan 14, 2005
Messages
73
ok so i am a compleate newb to jass i know some simple dos programing but not much more. i would like to know how i can get an interger to = itself+1 i tried somthing like this
set [integer] = [integer] + 1
oh and the [integer] stands for the name of my integer ok i am still quite new with jass but i started doing Qbasic programing a few years ago. My main problem with this though is that i dont know any of the commands or how they go together if u can supply me with the commands (or help me fix what i did wrong) for jass it would really help me

Thank You
 
Level 6
Joined
Sep 9, 2004
Messages
152
set (i)=(i)+1 should do the trick in ur script,but before you do that you must ensure that the integer exists(is created),a.k.a. local integer (i) = (number) (0 most commonly) ;

JASS:
function .... takes .... returns ....
local integer (i)=0
 set (i)=(i)+1
....
endfunction

(i) states the name of the integer.
 
Level 4
Joined
Jan 14, 2005
Messages
73
Thank You so much



i do have one other question though will this piece of code (trigger) reset my integer everytime it is run and if so can i fix it by making another trigger with just the set (i)=(i)+1 thx
 
Level 6
Joined
Sep 9, 2004
Messages
152
The integer (i) I introduce to you is a local variable this means it's created and can be only used by the current thread of the function.As calling/executing,the function creates a new thread and the local variable and it remains only for this thread.So to answer your question directly,you can't.You might use global variables wich can be manipulated by all threads keeping the same result.Another way is to store the integer value in a gamecache.If thats your prime objective.Hope i helped,honestley i really hard understood your question.Btw this is not a trigger it's a function,don't call 'em triggers,since they are things completly different from functions.
 
Level 4
Joined
Jan 14, 2005
Messages
73
k thx



edit: here is my question in different words "how can i use a global variable in a custom script to make it = itself + 1" thx for the help and sry for the trouble


Edit: K i think i found out how i can get it to work if i put

local integer C=C
Set C=C+1

would that work??? or do i need to use the call and execute commands because i dont know how to use them.
 
Level 4
Joined
May 6, 2006
Messages
79
check out the jass tutorial in the Tutorials section, i'm sure you will learn to jass in one day
 
Status
Not open for further replies.
Top