YesNoOk
avatar

Null (SCTRLs) (Read 2573 times)

Started by Ricepigeon, September 16, 2015, 04:46:08 pm
Share this topic:
Null (SCTRLs)
New #1  September 16, 2015, 04:46:08 pm
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
    • ricepigeon.neocities.org
Does nothing. May be used for temporarily disabling other state controllers by simply changing their type to Null.

Required parameters:
    none
Optional parameters:
    none

Additional Notes:
The Null SCTRL was originally intended to disable state controllers by changing their type to Null. However, it should be noted that while the Null SCTRL does nothing, the triggers for the Null controller are still processed by the MUGEN engine. As a result of this, the Null controller can be used in conjunction with the assignment (":=") operator as a replacement for the Varset SCTRL, as this for allows the assignment of multiple variables using a single state controller. For example;

Code:
[State 200, Varset]
type = Varset
trigger1 = time = 100
var(10) = 1

[State 200, Varset]
type = Varset
trigger1 = time = 100
var(11) = 40

[State 200, Varset]
type = Varset
trigger1 = time = 100
var(12) = 55

The above three Varset SCTRLs can be condensed into a single state controller using Null;
Code:
[State 200, MultiVarset]
type = Null
trigger1 = time = 100
trigger1 = (var(10):=1) || 1
trigger1 = (var(11):=40) || 1
trigger1 = (var(12):=55) || 1
This Null SCTRL is functionally equivalent to the three Varset controllers above.

In older versions of Mugen up to and including WinMUGEN, there exists a notorious glitch where if an excess number of Null SCTRLs exist within a single state, Player2's state information can be overwritten by Player1 without the need for custom states or making contact with attacks. This is usually abused by certain overpowered characters in order to KO Player2 immediately as soon as the match begins. MUGEN versions 1.0 and above are not affected by this glitch.
Last Edit: September 18, 2015, 02:47:49 pm by Just No Point
Re: Null (SCTRLs)
#2  September 17, 2015, 01:37:14 pm
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
Note that the "|| 1" is not necessary here. The result of a trigger-level variable assignment is the value you've assigned. So 1, 40, and 55 are all >= 1 and therefore "true." Those three trigger1s can be condensed onto one line as such:

Code:
trigger1 = var(10):=1 || var(11):=40 || var(12):=55
The "&&" operator can be used here as well, but it doesn't really matter unless you're relying on the values of these var to trigger the following trigger1, provided there is one.

Another use of "Null" is for quickly disabling State Controllers for testing purposes:
Code:
[State ]
type = Null ; PlaySnd
trigger1 = !time
value = 0,0
The following PlaySnd will not work anymore because it's been turned into a "Null" State Controller temporarily. When you want to enable it again and your testing is through, you just remove "Null ;" and you're good to go without having to rewrite anything.

-[Все слова это только слова.]-

Bea

Re: Null (SCTRLs)
#3  September 17, 2015, 02:13:07 pm
  • *****
  • MUGEN Grandma
    • Brazil
    • www.smeenet.org
That || 1 is extremely necessary in case any of your operations may return 0 (false), thus cancelling the execution of the next trigger chain.
Unless you are absolutely CERTAIN that your operations in that trigger line will never return 0, do not drop the || 1 from the expression.
Princess Adora: "My friend saw She-Ra take her dress off in the shower. She said she has an 8 pack. She said She-Ra is shredded."

SF2NES is dead. Long live SF2NES.
Re: Null (SCTRLs)
#4  September 17, 2015, 04:05:06 pm
  • *****
  • Gaps? Where we're going, we don't need gaps...
    • USA
    • ricepigeon.neocities.org
Pretty much what Bea said. Of course, in the examples I posted, the "|| 1"s aren't necessary since all three assignments are static, non-zero values, but its still good practice to add them, especially if your variable assignments utilize some kind of algorithm or computation that could potentially return 0 or bottom as a result.
Re: Null (SCTRLs)
#5  September 17, 2015, 05:00:33 pm
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
I'm aware and am always certain when I can and can't use it as such. I was just explaining that it can be done that way, not that it should. :)

For me personally, any time I can have less trigger#s, I go for it because they annoy me and we can't utilize whitespace for cleaner expression chains.

-[Все слова это только слова.]-