Zezombye / overpy

High-level language for the Overwatch Workshop with support for compilation and decompilation.
GNU General Public License v3.0
175 stars 25 forks source link

Allow usage of RULE_CONDITION in all contexts #323

Open piousdeer opened 1 year ago

piousdeer commented 1 year ago

When not used in the currently supported contexts, it should compile to the current rule's conditions, joined with ands. This would be especially useful for use with waitUntil:

rule "":
  @Event eachPlayer
  @Condition w
  @Condition x or y or z
  # do stuff
  waitUntil(not RULE_CONDITION, Math.INFINITY)
  # cleanup
nathan130200 commented 1 year ago

RULE_CONDITION i guess don't is exactly a value, its just a way to detect control blocks and creating actions for loop if condition is true/false and skip actions.

An short work-around is creating an macro with these conditions and reevaluating the macro in waitUntill action.

#!define myRuleTrigger (w and (x or y or z))

rule "do something":
  @Condition myRuleTrigger

  # do stuff
  # ...

  # wait untill trigger is not executed.
  waitUntill(not myRuleTrigger, 9999)

  # cleanup
  # ...