YesNoOk
avatar

Help with setting vars (Read 1672 times)

Started by Sam, December 27, 2021, 06:07:12 pm
Share this topic:

Sam

Help with setting vars
#1  December 27, 2021, 06:07:12 pm
  • avatar
  • ***
I have a config.txt file for my character, and inside it there's only one helper with a few vars.

The problem here is (and I know it sounds dumb but honestly I don't remember ever having this issue before): looks like I can't set more than 3 vars at the same time!

Here's the code:

Code:
[State 1210, VarSet]
type = null;
triggerall = !Time
trigger1 = var(0) := 1
trigger1 = var(1) := 0
trigger1 = var(2) := 0
trigger1 = var(3) := 1
trigger1 = var(4) := 1
ignorehitpause = 1

Vars 0, 1 and 2 work like a charm, but vars 3 and 4 don't!

How can I solve that?
Re: Help with setting vars
#2  December 27, 2021, 06:39:43 pm
  • **
  • Blue is cool.
    • USA
Try changing that code to this:

Code:
[State 1210, VarSet]
type = null;
triggerall = !Time
trigger1 = var(0) := 1 || 1
trigger1 = var(1) := 0 || 1
trigger1 = var(2) := 0 || 1
trigger1 = var(3) := 1 || 1
trigger1 = var(4) := 1 || 1
ignorehitpause = 1

See if that helps. If not, perhaps Var(3) and Var(4) are being changed by something else.
Sometimes I listen to video game music more than I actually play the game.
Check out my Bonus Game & Characters!: http://mugenguild.com/forum/topics/streets-rage-2-bonus-game-11-chars-162092.0.html
IKEMEN Version: https://mugenguild.com/forum/topics/streets-rage-2-bonus-game-ikemen-version-update-728-196297.0.html

Sam

Re: Help with setting vars
#3  December 27, 2021, 06:59:34 pm
  • avatar
  • ***
It did help! thanks man!
I didn't really get why tho. Could you elaborate a little bit?

Try changing that code to this:

Code:
[State 1210, VarSet]
type = null;
triggerall = !Time
trigger1 = var(0) := 1 || 1
trigger1 = var(1) := 0 || 1
trigger1 = var(2) := 0 || 1
trigger1 = var(3) := 1 || 1
trigger1 = var(4) := 1 || 1
ignorehitpause = 1

See if that helps. If not, perhaps Var(3) and Var(4) are being changed by something else.
Re: Help with setting vars
#4  December 27, 2021, 08:31:49 pm
  • **
  • Blue is cool.
    • USA
If I'm right, when using ':=", if the value to the right is 0, the remaining triggers don't get checked because a trigger returned false (0).

Lets look at your previous code:

Code:
[State 1210, VarSet]
type = null;
triggerall = !Time
trigger1 = var(0) := 1
trigger1 = var(1) := 0
trigger1 = var(2) := 0
trigger1 = var(3) := 1
trigger1 = var(4) := 1
ignorehitpause = 1

The first one for Var(0) works because the value to the right is not 0, so Var(0) gets set to 1 as normal.

But for the next trigger, the right value is 0, which returns 'false', which means that trigger (and the ":=") is ignored, and so are the rest of the triggers.

That is why Var(3) and Var(4) weren't being set; the triggers were being skipped. It technically wasn't working for Var(1) and Var(2) because of that, but since the default value for all variables is 0, it seemed that it was.

Adding "|| 1" to the triggers allows those triggers to work even if the value the variable is to be set to is 0, since || means "if either x or y is is non-zero, return true", so while Var(2) and Var(3) have the value that normally causes the skip effect, the "|| 1" causes a 'true' value to be returned, so those variables are 'set', and the remaining triggers are checked as normal.

I hope that was easy to understand. I'm terrible at explaining things.
Sometimes I listen to video game music more than I actually play the game.
Check out my Bonus Game & Characters!: http://mugenguild.com/forum/topics/streets-rage-2-bonus-game-11-chars-162092.0.html
IKEMEN Version: https://mugenguild.com/forum/topics/streets-rage-2-bonus-game-ikemen-version-update-728-196297.0.html