How to combine conditions with "and", "or", etc. into a single condition:
- Discover the Lua implementations of the conditions you want to combine.
- Combine them into a single Lua script.
To get the Lua implemetation for a condition, first select the condition you are interested in:
Then, choose "~Lua script~" in the pulldown menu:
Shown in the code window is the Lua function for evaluating the condition:local _, player = ...;
local attribs = player:GetClassAttributes();
return attribs.IsInBearForm and attribs:IsInBearForm();
- The first line gets the function's arguments (...) and assigns them into local variables (_, player). SequenceBars always passes the same two arguments when evaluating conditions: the Slot object, and the LocalPlayer object. (Since this condition doesn't care about the Slot object, it assigns the unobtrusive name "_" to it.)
- The last line checks whether your character is a Beorning (if so, then the function IsInBearForm will exist) and if so, whether you are currently in Bear form. It returns true or false.
Below the code window, there is a Play button (>). If you click this, the function will be executed immediately, and the result (true or false) is shown below the button.
Now let's choose another condition:
Then, choose "~Lua script~" in the pulldown menu to see the implementation:return Thurallor.Utils.Watcher.Player HasEffect("A Quiet Calm");
- This condition doesn't care about any arguments, so it ignores them.
- It uses a global utility function to determine whether the effect "A Quiet Calm" is currently active on your character, and returns true or false.
Now to combine the two conditions into one, we combine the two Lua scripts. For example, let's make an "OR" operation:local _, player = ...;
local attribs = player:GetClassAttributes();
return (attribs.IsInBearForm and attribs:IsInBearForm()) or Thurallor.Utils.Watcher.Player HasEffect("A Quiet Calm");