<!-- Script -->
<script>
<![CDATA[
require "tprint"
require "commas"
require "serialize"
require "copytable"
currentPowerlevel = 0
currentFatigue = 0
currentKi = 0
kiRestoreLevel = 0
plRestoreLevel = 0
fatigueRestoreLevel = 0
attackType = ""
currentAttack = ""
mobTarget = ""
healItem = ""
waterContainer = ""
willDevour = ""
willDrink = ""
kiLevel = 0
plLevel = 0
fatigueLevel = 0
function fightTriggerOn()
EnableTriggerGroup ("autoFarm", true)
end
function fightTriggerOff()
EnableTriggerGroup ("autoFarm", false)
end
function timerzOff()
EnableTimerGroup ("Timerz", false)
end
function timerzOn()
EnableTimerGroup ("Timerz", true)
end -- TimerzOn
function watchPrompt(name, list, args)
kilevel = string.gsub (args [2], ",", "")
currentKi = tonumber(kilevel) + currentKi
plLevel = string.gsub (args [1], ",", "")
currentPowerlevel = tonumber(plLevel) + currentPowerlevel
fatigueLevel = string.gsub (args [4], ",", "")
currentFatigue = tonumber(fatigueLevel) + currentFatigue
end -- watchPrompt
function setFleePowerlevel(name, list, args)
plRestoreLevel = args[1]
end -- setFleePowerlevel
function setFleeKiLevel(name, list, args)
kiRestoreLevel = args[1]
end -- setFleeKiLevel
function setFleeFatigueLevel(name, list, args)
mobTarget = args[1]
end -- setTarget
function healUp()
if (currentPowerlevel =< plRestoreLevel) then
fightTriggerOff()
timerzOff()
healTriggerOn()
end -- if statement
end -- healUp
function fatigueUp()
if (currentFatigue >= fatigueRestoreLevel) then
fightTriggerOff()
timerzOff()
fatigueTriggerOn()
end -- if statement
end -- fatigueUp
function kiUp()
if (currentKi =< kiRestoreLevel) then
fightTriggerOff()
timerzOff()
kiTriggerOn()
end -- if statement
end -- kiUp
function attackOnce()
Send(currentAttack .. mobTarget)
Send("sense" .. mobTarget)
end -- attackOnce
function setTarget(name, list, args)
mobTarget = args[1]
end -- setTarget
function setAttack(name, list, args)
currentAttack = args[1]
end -- setAttack
function setHealItem(name, list, args)
healItem = args[1]
end -- setHealItem
function setWaterType(name, list, args)
waterContainer = args[1]
willDrink = true
end -- setWaterType
function senseMobTarget()
Send("sense ".. mobTarget)
end -- senseMobTarget
function setDevourOn()
willDevour = true
end -- willDevour
function afterDeath()
if willDevour == "true" then
Send("--")
Send("get all all")
Send("Get Namek")
Send("Get Corpse")
else
Send("--")
Send("get all all")
Send("Get Namek")
end -- if statement
end -- afterDeath
function fatigueTriggerOn()
if willDevour == "true" then
Send("--")
Send("flee")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
Send("devour corpse")
fightTriggerOn()
elseif willDrink == "true" then
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
Send("drink" .. waterContainer)
else
Send("Camp")
Send("Sleep")
end -- if statement
end -- fatigueTriggerOn
function healTriggerOn()
Send("--")
Send("flee")
Send("swallow Senzu")
fightTriggerOn()
end
]]>
</script>
</muclient>Trouble With My Script
Posted by Dawastedpanda on Fri 23 Apr 2021 05:35 PM — 10 posts, 31,439 views.
Compile error
Plugin: AutoFarmer (called from world: DBE)
Immediate execution
[string "Plugin: AutoFarmer"]:216: ')' expected near '='
[WARNING] C:\Users\RAC\Downloads\LotjClient-master\LotjClient-master\worlds\plugins\AutoFarmerV1.xml
Line 82: Error parsing script (Cannot load)
Plugin: AutoFarmer (called from world: DBE)
Immediate execution
[string "Plugin: AutoFarmer"]:216: ')' expected near '='
[WARNING] C:\Users\RAC\Downloads\LotjClient-master\LotjClient-master\worlds\plugins\AutoFarmerV1.xml
Line 82: Error parsing script (Cannot load)
Quote:
Line 82: Error parsing script (Cannot load)
In line 82 of your script (counting from the first line which has require "tprint" in it) you have:
if (currentKi =< kiRestoreLevel) then
That is not a valid comparison. It should be:
if (currentKi <= kiRestoreLevel) then
You have the same problem in the healUp function.
Thank you that fixed my issue. Now I have another small one. Sorry for the simple questions, I'm still learning.
function attackOnce()
Send(currentAttack .. mobTarget)
end -- attackOnce
That is a function of mine. It's taking the variable currentAttack and using it against the mobTarget. My problem is that it's lumping them together. How do I get a space inbetween. It's coming out as.
BlastDragon instead of Blast Dragon
function attackOnce()
Send(currentAttack .. mobTarget)
end -- attackOnce
That is a function of mine. It's taking the variable currentAttack and using it against the mobTarget. My problem is that it's lumping them together. How do I get a space inbetween. It's coming out as.
BlastDragon instead of Blast Dragon
Send(currentAttack .. " " .. mobTarget)
Or:
Send(currentAttack, " ", mobTarget)
Send
The documentation for the Send script function is available online. It is also in the MUSHclient help file.
I'm sorry for all the questions. I'm having another problem with a part in this script.
function watchPrompt(name, list, args)
kilevel = string.gsub (args [2], ",", "")
currentKi = tonumber(kilevel) + currentKi
plLevel = string.gsub (args [1], ",", "")
currentPowerlevel = tonumber(plLevel) + currentPowerlevel
fatiguelevel = string.gsub (args [4], ",", "")
currentFatigue = tonumber(fatigueLevel) + currentFatigue
if (currentPowerlevel <= plRestoreLevel) then
ColourNote("yellow","", "Powerlevel Low. Fleeing to heal.")
fightTriggerOff()
timerzOff()
healTriggerOn()
elseif (currentFatigue >= fatigueRestoreLevel) then
ColourNote("yellow","", "Fatigue High. Fleeing to restore.")
fightTriggerOff()
timerzOff()
fatigueTriggerOn()
elseif (currentKi <= kiRestoreLevel) then
ColourNote("yellow","", "Ki is low. Fleeing to restore.")
fightTriggerOff()
timerzOff()
kiTriggerOn()
else
fightTriggerOn()
timerzOn()
return
end --if statement
end -- watchPrompt
This is the trigger that's calling that bit of script. The problem is it's not accurately monitoring the prompt and firing off the functions.
<trigger name= "monitorPrompt" match= "[Pl:*%][Ki:*%][*% EXP][Fatigue: *%]*" group= "Monitor" script= "watchPrompt" enabled= "y" regexp= "n" sequence= "100"/>
It's hard to say without see samples of the prompts that are not working.
[Pl:11,666,557][Ki:8,504,392][86% EXP][Fatigue: 0%][HT][FM]This is an example of the prompt. I want it store variables for curentPowerlevel, CurrentKi and CurentFatigue. It should compare those variables to another variable that gets set by the user like 1,500,000.
Do you mean it is doing it sometimes or not at all?