lotrointerface.com
Search Downloads


Go Back   Thurallor's Portal

Advanced Conditionals
SequenceBars » Advanced Conditionals

Advanced Conditionals

Normally, a conditional slot (if...then... / if...then...else...) can only operate on a single condition; for example: whether a single skill is ready, or whether a single effect is on the player. However, it is possible to implement more complex logic with multiple conditions and logical relationships (and / or / not).

“If A and B...”
Simple "And" logic can be implemented by nesting conditionals. For example, if you would like to test for the presence of two buffs on your character (let's call them effect1 and effect2), you can do it with nested conditionals, as shown:
  1. "If effect1 is present..."
  2. "If effect2 is present..."
  3. Skill(s) that you want to appear if both effects are on your character.
  4. End of the "If" in slot 2.
  5. End of the "If" in slot 1.
  6. The sequence continues.
“If not A...”
The negations for most conditions can be selected in the pulldown menu. For example, you can choose "In combat" or "Not in combat"; "Effect is present" or "Effect not preset", etc. However, there are some exceptions. For example, "Stance": There is no "Not in stance" condition that you can select directly from the menu. Instead, to detect this case, you need to use the "else" part of an if...then...else... conditional:
  1. "If your character is in stance..."
  2. "else..."
  3. Skill(s) that you want to appear if not in the specified stance.
  4. End of the "If" in slot 1.
  5. The sequence continues.
“If A or B...”
"Or" logic can be implemented by duplicating the consequent. In essence, instead of
If A or B then do C.
you can do the following, which is equivalent:
If A then do C; otherwise, if B then do C.
  1. "If A..."
  2. C
  3. "Otherwise..."
  4. "If B..."
  5. C
  6. End of the "If" in slot 4.
  7. End of the "If" in slot 1.
  8. The sequence continues.
If C is a more complex sequence, then you should use an Include slot, so you can define C only once, and include it multiple times:
More complex logic with Lua
Any logic more complicated than the simple examples above quickly becomes a rat's nest in the sequence editor, which is hard to understand, test, and maintain. In such cases, usually it's better to use the Lua Script feature to combine the logic into a single "If" conditional with a complex condition. You don't need to be a Lua programmer to be able to do this.
  1. "If (complex condition)..."
  2. Do something.
  3. End of the "If" in slot 1.
  4. The sequence continues.
To formulate your complex condition in slot 1, you first need to discover the Lua code for the individual conditions you are interested in. For example, if you want to find the Lua code for testing the presence of a "Disease" debuff:
  • Create an if...then... slot.
  • Select the condition ("Debuff: Disease") in the pulldown menu.
  • In the same pulldown menu, change the condition to "~Lua Script~".
  • You will see the Lua code for testing this condition:
return Thurallor.Utils.Watcher.PlayerHasEffectCategory(Tu rbine.Gameplay.EffectCategory.Disease);
The part in green is the Lua code you need for testing this condition. To simplify the explanation, we will call it A for short. Then suppose we want to do a complex condition, such as
If (A and B) or (C and not D)...
Use the same procedure to find the Lua code for testing B, C, and D. Then you can easily combine the tests into a single Lua script:
return (A and B) or (C and not D);
Of course, you should replace the letters A, B, C, D with the Lua code for each test. (You may add as many parentheses as desired, to eliminate ambiguity.)

Other Tips
  • When testing Lua scripts, you can click the "play" button below the script box to check that it's working. The return value is displayed immediately below. (In Lua, the special value nil is deemed false in boolean expressions; all other values are deemed true.)

  • Blank slots in the sequence are ignored. So you may add as many blank spots as you want, if it makes the sequence easier to understand.

  • You can open a debug window for each bar / group to monitor the events and see what it's doing.

SequenceBars » Advanced Conditionals
 
Menu
» Home



Content

Stats
Files: 18
Downloads: 847,585
Favorites: 345

New & Updated


LOTROInterface


All times are GMT -5. The time now is 07:15 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui