Xorot's Elixir Queue

From Gwen Morse's Wiki
Jump to: navigation, search

Found here: [http://www.achaea.com/forum/tinyfugue-scripts]

;
; if you want to set up a queue, i'm using in some cases this:
;  
; now all you have to do is:
;
; make some triggers to set %balance_elixir either to 0 or 1, 
; depending on whether you drank something or not
; start the queue for elixirs once via /elixir_thread
;
; to queue something now (in that case elixirs) you may want to 
; try: /def mana = /queue_elixir drink mana

; doing /mana now will result in drinking mana if you've 
; elixirbalance, or waiting until you regain it. you can 
; increase that by adding a /doelixirqueue at the trigger 
; for regaining elixirbalance

/set __elixir_stack=
/set __elixir_stack_lock=0

/def queue_elixir = \
/if (%__elixir_stack_lock) \
  /repeat -1 1 /queue_elixir %*%; \
/else \
  /set __elixir_stack=%__elixir_stack%*%__terminator%; \
/endif

/def doelixirqueue = \
/if (%balance_elixir & (strlen(__elixir_stack) > 0)) \
  /let command=$[substr(__elixir_stack,0,strstr(__elixir_stack,__terminator))]%; \
%command%; \
  /set __elixir_stack_lock=1%; \
  /set __elixir_stack=$[substr(__elixir_stack,strstr(__elixir_stack,__terminator) + strlen(__terminator))]%; \
  /set __elixir_stack_lock=0%; \
/endif

/def elixir_thread = \
  /doelixirqueue %;
  /repeat -1 1 /elixir_thread