Hi, this is a simple tutorial I made some time ago about how to use the variables properly. I rarely write tutorials, so if I did some confusion or made a mistake, sorry. In this case, I ask you to help me and point the errors.Also, keep in mind that this tutorial was done to help beginners._________________________________________________ _______________________________1 - What is a var?A var is a variable value (lol capitain obvious). And this value may be what you want. There are 2 types of var: var(x) (int values: 1,2,3,10,50, etc) and fvar(x) (fractions: 1.2, 2.45, 6.78787. etc). 60 vars [var(0) ~ var(59)] and 40 fvars [fvar(0) ~ fvar(39)] can be used.An important thing: by 'default', MUGEN identifies the last 10 vars, [var(50) ~ var(59)], as vars that do not change his values between the rounds. This can be modified in the parameters of chars. So be careful using these vars.Then a var is always an integer value and a fvar is always a fraction. Example:Quotecorrect[state 15, var]type = varsettrigger1 = 1var(5) = 2wrong[state 90 var]type = varsettrigger1 = time = 50var(40) = 2.0correct[state 2000, var]type = varsettrigger1 = 1fvar(12) = 3.56wrong[state 1500 var]type = varsettrigger1 = time = 50fvar(10) = 6There is still a third type of var, the sysvars (literally, system variables), which can be sysvars or sysfvars. These are specifically for issues of common1. CNS - to the 'standards' of the engine._________________________________________________ ________________________________2 - Specific Sctrls*this can be found in the mugendocs, though.a) varaddAs the name says, this sctrl add a value to the var."Actual value + Varadd's value = New Value"Example:[mcode][state 100, var]type = varaddtrigger1 = time = 0var(10) = 1[/mcode]Using a fvar:[mcode][state 100, var]type = varaddtrigger1 = animelem = 3fvar(25) = -5.35[/mcode]b) varsetThis sctrl will set a new value, instead of add a value (like varadd sctrl).Example:[mcode][state 305, var]type = varsettrigger1 = time = 50var(5) = 2[/mcode]Now using a fvar:[mcode][state 305, var]type = varsettrigger1 = statetype = Afvar( = 1.256[/mcode]c) varrandonThis sctrl stipulates a random value to the var. Only integers, so, don't works with fvars.Example:[mcode][state 200, var]type = varsettrigger1 = statetype = Cv = 8range = 0,10[/mcode]*range = minor value, major valued) varrangesetFinally, this sctrl stipulates a certain valor in multiple vars.Example:[mcode][State 1000, 3]type = VarRangeSettrigger1 = time = 0value = 0first = 0last = 59[/mcode]*first = first var, last = last var_________________________________________________ ________________________________3 - How can I use it?Basically, the var will stocking a value. Example:[mcode][state 1000, var]type = varsettrigger1 = time = 0var(0) = 10[/mcode]In this example, the var(0) received the value 10 (the var is equals 10). It does not seem very amazing... but look the next example:[mcode][state 1001, var]type = varsettrigger1 = time = 0var(1) = (10 + var(0)*time/3) + (25*time/2 + (var(10)/3))[/mcode]Now, the var(1) is equals "(10 + var(0)*time/3) + (25*time/2 + (var(10)/3))". If I need to write a sctrl using this value, I can only write var (1) in its place, because it is the same thing. This is the magic about vars. Another example:[mcode][state 1000, var]type = varsettrigger1 = stateno = 300trigger1 = Anim = 200trigger1 = animelem = 3var(1) = 2[state 1000, var]type = changestatetrigger1 = stateno = 300trigger1 = Anim = 200trigger1 = animelem = 3value = 301or[state 1000, var]type = changestatetrigger1 = var(1) = 2value = 301[/mcode]_________________________________________________ ________________________________Sorry, my english is not the best. But I tried to do everything as clearly as possible.If anyone has any complement or correction, please feel free to post.
And i wouldn't. This is not the best tutorial written. It doesn't explain what it should and glosses over things it shouldn't as well as getting bits and pieces wrong altogether.DM i'm sure has improved and may want to re-write this. If you actually have a coding related question please direct it to the dev help section.