Hi there, new to lua and I am trying to learn some things so i can build more advanced scripts in the future.
I am trying to use a variable in a trigger, and also in a script that send to the mud all from within a plugin.
Pastebin is here:
http://pastebin.com/m3a86d453
Line 27 I attempt to declare a global
Line 52 I attempt to use it in a trigger
The script section starting at line 98 works perfectly. What am I doing wrong for the Trigger section?
Heres the code for those who dont want to clicky pastebin:
I am trying to use a variable in a trigger, and also in a script that send to the mud all from within a plugin.
Pastebin is here:
http://pastebin.com/m3a86d453
Line 27 I attempt to declare a global
Line 52 I attempt to use it in a trigger
The script section starting at line 98 works perfectly. What am I doing wrong for the Trigger section?
Heres the code for those who dont want to clicky pastebin:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 27, 2009, 8:13 PM -->
<!-- MuClient version 4.40 -->
<!-- Plugin "repairgrinder" generated by Plugin Wizard -->
<muclient>
<plugin
name="repairgrind2"
author="Terensque"
id="ce3de8b3aa85d6f6eba44dac"
language="Lua"
purpose="grind repair with tv"
date_written="2009-07-27 20:12:59"
requires="4.40"
version="1.0"
>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Declare a global for the triggers -->
repairobject = "television"
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="^It's completely destroyed.$|^Sybian curses in frustration and gives up.$|^You fixed some of the damage.$"
regexp="y"
name="needs_repair"
script="repair"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="You fixed all of the damage."
script="repair"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="^Sybian's (.*?) against (.*?) (repairobject).$|^Sybian's (.*?) puts a dent in (.*?) (repairobject).$|^Sybian's (.*?) into (.*?) (repairobject)(.*?)$|^Sybian's (.*?) scuffs (.*?) (repairobject)(.*?)$"
regexp="y"
name="check_repair"
script="repair"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="^It's (.*?) damaged.$|^It's a little dinged up.$"
regexp="y"
name="needs_kill"
script="repair"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="^[ You earned (.*?) IP in repair! ]$|^[ You spent (.*?) for (.*?) IP in repair! ]$"
regexp="y"
name="check_grind"
send_to="10"
sequence="100"
>
<send>
score
</send>
</trigger>
<trigger
enabled="y"
match="(.*?) you can for today(.*?)$"
regexp="y"
name="end_grind"
script="repair"
sequence="100"
>
</trigger>
</triggers>
<script>
local repairobject
repairobject = "television"
function repair (sTrig)
if sTrig == "needs_repair" then
Send ("repair " .. repairobject)
elseif sTrig == "needs_kill" then
Send ("kill " .. repairobject)
elseif sTrig == "check_repair" then
Send ("examine " .. repairobject)
elseif sTrig == "end_grind" then
Print ("Repair grind complete")
else
Send ("kill " .. repairobject)
end
end -- repair
</script>
</muclient>