YesNoOk
avatar

M.U.G.E.N Bitwise operator malfunction? (Read 36927 times)

Started by Redash, January 18, 2021, 07:16:00 am
Share this topic:
M.U.G.E.N Bitwise operator malfunction?
#1  January 18, 2021, 07:16:00 am
  • avatar
  • **
    • Singapore
Hi,

I want to set ONLY the FIRST bit from 1 to 0, how do you do that in MUGEN?

 '~' operator seems not working >_<



      Posted: January 18, 2021, 07:31:54 am
Sorry, some sad workaround discovered is Var(n) & 2147483646) but this is horrible...

Wonder if anyone can share a better solution? Or this is the ONLY solution in MUGEN?

      Posted: January 18, 2021, 07:35:59 am
The end result is unstable...

(Var(n) := Cond((Random % 2), (Var(n) | 2**0), Var(n) & 2147483646))

Sometimes it will be 1 even if Random % 2 returns 0... really need help on what is going on ?

     Posted: January 18, 2021, 07:47:36 am
Can someone help me if what would be a good BIT FLAG expression replacement in a Null SCTRL on below VarSet SCTRL ?

[State 10001, Var(1)Set]
type      = VarSet
trigger1   = (Time = 0)
v      = 1
value   = Random % 2
ignorehitpause   = 1
persistent   = 0

Last Edit: January 18, 2021, 07:47:36 am by Redash
Re: M.U.G.E.N Bitwise operator malfunction?
#2  January 18, 2021, 01:26:16 pm
  • *****
  • Resident Tosspot
  • Pftheh
    • UK
    • plasmoidthunder.neocities.org
If the VarSet works then why does it need to be a Null? You can assign bits via VarSet too.

Regardless...
Code:
[State n, Null]
type = Null
triggerall = time = 0
trigger1 = random%2 = 0 && (var(n)&1) = 1
trigger1 = 1||var(n) := (var(n)&1)-1
trigger2 = random%2 = 1 && (var(n)&1) = 0
trigger2 = 1||var(n) := (var(n)|1)

Oh, I want a diagram. I fucking love diagrams.
Re: M.U.G.E.N Bitwise operator malfunction?
#3  April 08, 2021, 07:33:37 am
  • avatar
  • **
    • Vietnam
trigger method: Trigger1 = 1||var(n):=(var(n)|1)-1

Or varset method var(n) = (var(n)|1)-1

     Posted: April 08, 2021, 07:38:18 am
With fvar

Trigger method: trigger1 = 1||fvar(n):=(floor(fvar(n))|1)-1

Varset method: fvar(n) =(floor(fvar(n))|1)-1
------Tremble Mortal and Despair. Doom has come to this world------