Post by mrx on Jun 11, 2022 20:51:54 GMT
It requires the progress bar script, if you don't want to use it, just comment the two lines that have progressBar
Output example updated in real time:
require "progressBar"
function openSkillBook()
FindButton("SkillWindow")
while FINDBUTTON == nil do
Key("K")
sleep(400)
FindButton("SkillWindow")
end
end
function getSkillLevel(skillName)
FindButton("SkillWindow", skillName)
return tonumber(string.match(FINDBUTTON[2].TEXT, "[%d%.]+")) or 0
end
function trainSkill(macro, weaponName)
Macro(macro)
WaitForTarget()
FindItem(weaponName, BACKPACKID)
TargetDynamic(FINDITEM[1].ID)
-- Click on the first page to refresh skill value
ClickButton("SkillWindow", "22")
sleep(1000)
end
function displayTime(time)
local hours = math.floor(time % 86400)/3600
local minutes = math.floor(time % 3600)/60
local seconds = math.floor(time % 60)
return string.format("%02d:%02d:%02d",hours,minutes,seconds)
end
function displayInfo(initialTime, initialSkill, skillLevelGoal)
skillLevelGoal = skillLevelGoal or 100
local skillLevel = getSkillLevel("arms")
local skillGained = skillLevel - initialSkill
local timePassed = TIME - initialTime
local gainsPerHour = skillGained / (timePassed / 3600)
clear()
print("Initial skill: " .. initialSkill)
print("Current skill: " .. skillLevel)
print("Time passed: " .. displayTime(timePassed))
print("Skill gained: " .. string.format("%.1f", skillGained))
if gainsPerHour == 0 then
print("Estimated gains per hour: Calculating ...")
else
print("Estimated gains per hour: " .. string.format("%.1f", gainsPerHour))
end
progressBar(skillLevel, 50)
if skillLevel >= skillLevelGoal then
print("Skill level goal achieved, stopping script ...")
StopAllScripts()
end
end
openSkillBook()
-- Triggers the action assigned to the first slot on the left panel
local armsLoreMacro = 0
local initialTime = TIME
local initialSkill = getSkillLevel("arms")
local weaponName = "flute"
while true do
trainSkill(armsLoreMacro, weaponName)
displayInfo(initialTime, initialSkill)
end
Output example updated in real time:
Initial skill: 1.2
Current skill: 10.4
Time passed: 00:03:47
Skill gained: 9.2
Estimated gains per hour: 145.4
[====== ] 10.4%
Current skill: 10.4
Time passed: 00:03:47
Skill gained: 9.2
Estimated gains per hour: 145.4
[====== ] 10.4%