By looking at examples I tried to piece something together on how to script an alias that turns a trigger on, have a trigger match, and have the trigger run a script. I realize now that I might be taking bits from different areas, and though my intention was to use lua it might not be.
My goal was to make a trigger I could turn on/off that would get my character to rest if movement points fell below 120. The trigger would then disable so it would not spam rest. I could then toggle the trigger back on with the alias if I wanted. This was more a test to see if I could use some features together.
Below is what I scripted for lua.
I am a complete newbie to any coding language so I probably should have figured out each piece on it's own first. Any guidance would be appreciated.
If I can figure this out next I'll tackle how to use the wait module.
[EDIT] Code tags added.
My goal was to make a trigger I could turn on/off that would get my character to rest if movement points fell below 120. The trigger would then disable so it would not spam rest. I could then toggle the trigger back on with the alias if I wanted. This was more a test to see if I could use some features together.
Below is what I scripted for lua.
<aliases>
<alias
name="ToggleMovement"
match="moveset" -- I assume this is the command I enter
enabled="y"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>
enabletrigger (movement, true)
ColourNote ("sienna", "thistle", "MOVESET")
</send>
</alias>
</aliases>
<triggers>
<trigger_enabled="y" match="^(.*?)H (.*?)V (.*?)X" script="restore" other_back_colour="black" other_text_colour="black" sequence="100" regexp="y" name="movement"> </trigger> -- the prompt it is matching to is something like 300H 130V 2323232X then more text
</triggers>
<script>
<![CDATA[
function restore()
{
if(%2 < 120)
{
world.execute("rest");
enabletrigger ("movement", false);
}
}
]]>
</script>
I am a complete newbie to any coding language so I probably should have figured out each piece on it's own first. Any guidance would be appreciated.
If I can figure this out next I'll tackle how to use the wait module.
[EDIT] Code tags added.