Variables set by SetVariable() can just be queried like any other variable, right? Or would I need to use GetPluginVariable() each time? Perhaps this should go under a different topic, but would this plugin work if serialized? It increments a variable to decide which to do next, but also increments classes. As you'll see, the table structure is: skills[class][skill]. I was just wondering if this could be serialized and be able to be incremented. If so, how?<!-- Aliases -->
<aliases>
<alias
match="rstart"
enabled="y"
sequence="100"
send_to="12"
>
<send>Send("research ", skills[0][0])
EnableTriggerGroup("research", true)</send>
</alias>
</aliases>
<!-- Triggers -->
<triggers>
<trigger
enabled="n"
group="research"
match="^You\'re not ready to learn that yet\, Sorry\.\.\.\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>class = class + 1
skill = 0
if class == 9 then
Send("afk")
EnableTriggerGroup("research", false)
return
elseif skills[class][skill] == nil then
end -- if
Send("research ", skills[class][0])</send>
</trigger>
<trigger
enabled="n"
group="research"
match="^You can\'t learn (any more )?about that (from books\!|in books\. Go find a teacher\.)$"
regexp="y"
send_to="12"
sequence="100"
>
<send>if skill == table.getn(skills[class]) then
class = class + 1
if skills[class] == nil then
Send("afk")
return
end -- if
skill = -1
end -- if
skill = skill + 1
Send("research ", skills[class][skill])</send>
</trigger>
<trigger
enabled="n"
group="research"
match="^You (study for hours on end\, but fail to gather any knowledge|finish your studies and feel much more skilled)\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send("research ", skills[class][skill])</send>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
class = 0
skill = 0
skills = {
-- Combat
[0] = {
[ 0] = "grenades",
[ 1] = "scan",
[ 2] = "vibro-blades",
[ 3] = "force pikes",
[ 4] = "bowcasters",
},
-- Piloting
[1] = {
[ 0] = "navigation",
[ 1] = "ship systems",
[ 2] = "small spacecraft",
[ 3] = "weapon systems",
[ 4] = "dock",
},
-- Engineering
[2] = {
[ 0] = "gather",
[ 1] = "makecontainer",
[ 2] = "makecanteen",
[ 3] = "makecircuit",
[ 4] = "makeflashlight",
},
-- Diplomacy
[3] = {
[0] = "smalltalk",
[1] = "bribe",
[2] = "setleader",
[3] = "propaganda",
[4] = "broadcast",
},
-- Leadership
[4] = {
[0] = "teach",
[1] = "jail",
[2] = "call",
[3] = "torture",
},
-- Espionage
[5] = {
[ 0] = "duplicate",
[ 1] = "swipe",
[ 2] = "tail",
[ 3] = "conceal",
[ 4] = "sabotage",
},
-- Slicer
[6] = {
[ 0] = "showplanet",
[ 1] = "showclan",
[ 2] = "lookup",
[ 3] = "remodulate",
[ 4] = "short",
},
-- Medical
[7] = {
[ 0] = "aid",
[ 1] = "first aid",
[ 2] = "diagnose",
[ 3] = "makemedpac",
[ 4] = "revive",
},
-- Science
[8] = {
[ 0] = "ponder",
[ 1] = "advanced electronic",
[ 2] = "chemistry",
[ 3] = "construction",
[ 4] = "data",
},
}
]]>
</script>
(Because of the length of the table, I cut it down to just 5 parts when I copied it over to here, though it is CERTAINLY longer. ;P) What I have been trying to do before, but have been unable, is make another table like below that would hold the progress of the different classes, and then start where they left off next time.researched = {
[0] = 0,
[1] = 0,
-- etc
}
The plugin would just change researched[class] to `skill' each time "^You can\'t learn (any more )?about that (from books\!|in books\. Go find a teacher\.)$" was matched. |