YesNoOk
avatar

What exactly ":=" does? (Read 1409 times)

Started by DeathScythe, July 24, 2018, 03:33:09 pm
Share this topic:
What exactly ":=" does?
#1  July 24, 2018, 03:33:09 pm
  • ****
    • crepa.neocities.org

  • Online
I've read the docs that come with MUGEN, but I still don't understand what := does. I know that it must have a var on the left side, but then?
Re: What exactly ":=" does?
#2  July 24, 2018, 03:44:07 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
  • :=

    The assignment operator. An unredirected variable name (var(n) or fvar(n) for suitable values of n) must appear on the left-hand side. If the left-hand side contains an integer variable, then the right-hand side is truncated to an integer before assignment. If the left-hand side contains a float variable, then the right-hand side is converted to float if necessary before assignment. In both cases, the value of the expression is the value that is assigned to the variable.

example:
Code:
trigger1 = var(0):=55 ;sets var(0) to 55
Re: What exactly ":=" does?
#3  July 24, 2018, 03:56:07 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
It is set if MUGEN evaluates it.
That's why it is popular to use this in a "Null" controller to set numerous vars in one place, for various triggers.

Example:

type = Null
trigger1 = anim = 100
trigger1 = var(5) := 1
trigger2 = anim = 200
trigger2 = var(5) := 2

MUGEN will skip the second trigger1 and trigger2 if the first condition is false.

Re: What exactly ":=" does?
#4  July 24, 2018, 04:09:13 pm
  • ****
    • crepa.neocities.org

  • Online
Oh, I got it. Thank you :)