[RMVX ACE] CONDITIONAL BRANCHES AND VARIABLES

Posts

Pages: 1
I had done a couple small tutorials on variables and have been successful in modifying them to do different things.
In the tutorials that I read, when setting up the conditional branches, they instructed to not check (or uncheck) "set handling when conditions do not apply". I'm assuming there must be applications where it is used. Could someone explain the difference of checking it or not checking it? Thanks
I was unable to find anything about this elsewhere.
If you speak of putting other conditions after the "else", there is some reason we usually avoid that: it tends to leave the code messy (harder to read).

Condition if
 bla bla
  else
   Condition if
    blabla
     else
      Condition
       blabla and other stuff until you have to scroll to the right to see your code.
     end
  end
end
You should refrain from doing that if you must insert several conditions in the else segment. It's still usefull for cheching 1 or 2 things (like when you check the hero coordinates with 4 variables to see if he moved, because there isn't too many else)

A proper way is to use labels if need be (when you don't want the second condition to be met).
Example 1:
Condition if Hero member= Actor1
 blabla
end
Condition if Hero member = Actor2
 blabla
end
Since member 1 is a unique result (it can't be at the same time Actor 1 and Actor 2), there is no need to use labels/else here.

Example 2:
Condition if Actor1 is in the party
 blabla
 Jump to Label 1
end
Condition if Actor2 is in the party
 blabla
 Jump to Label 1
end
all your other conditions
Label 1
You can have Actor 1 and 2 in the team at the same time. If you don't want other conditions to be executed when the first one is met, the label works as an else in this case, keeping the code clean.

I hope it's what you were looking for.
author=Gari
If you speak of putting other conditions after the "else", there is some reason we usually avoid that: it tends to leave the code messy (harder to read).

Condition if
 bla bla
  else
   Condition if
    blabla
     else
      Condition
       blabla and other stuff until you have to scroll to the right to see your code.
     end
  end
end

You should refrain from doing that if you must insert several conditions in the else segment. It's still usefull for cheching 1 or 2 things (like when you check the hero coordinates with 4 variables to see if he moved, because there isn't too many else)

A proper way is to use labels if need be (when you don't want the second condition to be met).
Example 1:
Condition if Hero member= Actor1
 blabla
end
Condition if Hero member = Actor2
 blabla
end

Since member 1 is a unique result (it can't be at the same time Actor 1 and Actor 2), there is no need to use labels/else here.

Example 2:
Condition if Actor1 is in the party
 blabla
 Jump to Label 1
end
Condition if Actor2 is in the party
 blabla
 Jump to Label 1
end
all your other conditions
Label 1

You can have Actor 1 and 2 in the team at the same time. If you don't want other conditions to be executed when the first one is met, the label works as an else in this case, keeping the code clean.

I hope it's what you were looking for.
Thank you,Gari
Pages: 1