Skip to content

Instantly share code, notes, and snippets.

@jandersson
Created April 27, 2018 18:58
Show Gist options
  • Save jandersson/da4ec098a6f62cbe698d20dc885da840 to your computer and use it in GitHub Desktop.
Save jandersson/da4ec098a6f62cbe698d20dc885da840 to your computer and use it in GitHub Desktop.
basic lich trigger
# This line is required, it basically includes the Flags we'll use to monitor the game text
custom_require.call %w[events]
# Create a Flag. This monitors the game text in the background. The first argument is the name. The second part is the text to match. You can use regular expressions here if you want.
Flags.add('watch-for-trouble', 'Trouble just arrived!')
# Make a simple loop (make all your Flags outside of the loop)
loop do
# Check the status of your flag. If the flag was tripped, then the if part here will evaluate to true. If it did not then the code inside the if gets skipped
if Flags['watch-for-trouble']
# We found trouble
# Make sure you lower the flag if it was tripped
Flags.reset('watch-for-trouble')
# Do whatever you want here
fput('say omg its trouble')
end
# Change this to whatever you like, this is just to keep the loop from wasting your cpu time
pause 0.20
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment