Here's what I have in my script file.
afflicted_by = {} -- table of current afflictions
applying = false -- are we currently applying a salve?
-- cures for afflictions, put in order you want them cured
salvecures: = {
{ name = "anorexia" , cure = "epidermal" },
{ name = "silerisdef" , cure = "sileris" },
{ name = "legrest1" , cure = "restoration" },
{ name = "legrest2" , cure = "restoration" },
{ name = "legmend2" , cure = "mending" },
{ name = "legmend2" , cure = "mending" },
{ name = "headrest" , cure = "restoration" },
{ name = "armrest1" , cure = "restoration" },
{ name = "armrest2" , cure = "restoration" },
{ name = "armmend1" , cure = "mending" },
{ name = "armmend2" , cure = "mending" },
{ name = "torsorest" , cure = "restoration" },
{ name = "burning" , cure = "mending" },
{ name = "shivering" , cure = "caloric" },
{ name = "caloricdef" , cure = "caloric" },
{ name = "massdef" , cure = "mass" },
} - end of salvecures
function do_cure ()
if applying or
afflicted_by.food or
afflicted_by.anorexia then
return
end -- if can't do it yet
-- find most urgent one to cure
for _, v in ipairs (salvecures) do
if afflicted_by [v.name] then
if v.cure ~= "" then -- some afflictions might not have cures
Send ("apply ", v.cure) -- apply it
applying = true
return -- done
end -- of having a cure for it
end -- found one
end -- for
end -- function do_cure
Note: When I copied it from my script file, the spacing messed up so it's all left alligned now.
Here's the error.
[string "Script file"]:6: <name> expected near `='
To the best of my knowledge (which I know in this subject is not very extensive), my script is pretty much exactly how you had it earlier, except with the changes specific to my file. Can you show me what I've done wrong?
|