Maybe instead of
Code: Select all
Item name: Golden Eggs per hour:5.5 Time Passed: 2
Code: Select all
Golden Eggs: 11 (5.5/h) Time passed: 2
I couldn't think of a shorter way to write "Time passed" unfortunately.
Code: Select all
Item name: Golden Eggs per hour:5.5 Time Passed: 2
Code: Select all
Golden Eggs: 11 (5.5/h) Time passed: 2
Code: Select all
sprintf(_charname.." ".._itemname..": "
.._currentitems.." (".._itemsperhour.."/h) Time(h): ".._printtime)
Code: Select all
registerTimer("setwindow", secondsToTimer(30), _window);
yrest(1000)
_window()
Code: Select all
function setwindow(ID)
unregisterTimer("timedSetWindowName");
unregisterTimer("setwindow")
local _starttime = os.time()
--=== track in game gold ===--
if ID == "gold" then
local currentgold = RoMScript('GetPlayerMoney("copper");')
local function _window()
local _charname = string.sub(player.Name,1,7)
local _timepassed = (os.time() - _starttime)/3600
local _printtime = string.sub(_timepassed,1,4)
local _goldreceived = RoMScript('GetPlayerMoney("copper");') - currentgold
local _goldperhour = string.sub((_goldreceived/_timepassed),1,4)
setWindowName(getHwnd(),sprintf(_charname.." Gold per hour: "
.._goldperhour.." Time passed: ".._printtime))
end
registerTimer("setwindow", secondsToTimer(30), _window);
else
local _itemname
--=== ID as item name or item ID ===--
if type(tonumber(ID)) == "number" then -- arg is item Id
_itemname = string.sub(GetIdName(ID),1,10)
else
_itemname = string.sub(ID,1,10)
end
local _startitem = inventory:itemTotalCount(ID)
local function _window()
local _charname = string.sub(player.Name,1,7)
local _timepassed = (os.time() - _starttime)/3600 -- total time in hours
local _printtime = string.sub(_timepassed,1,4)
local _gathereditems = inventory:itemTotalCount(ID) - _startitem -- total items aquired since starting
local _itemsperhour = string.sub((_gathereditems/_timepassed),1,4)
local _currentitems = inventory:itemTotalCount(ID)
setWindowName(getHwnd(),sprintf(_charname..". ".._itemname..": "
.._currentitems.." (".._itemsperhour.."/h) Time(h): ".._printtime))
--setWindowName(getHwnd(),sprintf("1234567890123456789012345678901234567890123"))
end
registerTimer("setwindow", secondsToTimer(30), _window);
yrest(1000)
_window()
end
end
Yeah I should, pretty much copy pasted my gold tracker userfunction code for that, code I did like 6+ months ago.rock5 wrote:Use "inventory.Money" instead.
You can probably find a post of mine from about 10 months ago where I asked about changing what is printed to the window, at that time I knew nothing about lua code. So yeah idea has been floating around for a whileYoder wrote:But you guys really took off with this idea
It goes like this, call the function in the onload of a WP and set the argument to what you want to track. It can be any item, use either item name or item ID. You can also have "gold" as the arg and then it will track gold. I concidered xp but the default bot does xp already.Yoder wrote:So is your goal here to pre-define all settings or just the main formatting?
Code: Select all
setwindow("gold") -- tracks gold
setwindow(208473) -- Herb of Hope
setwindow(204792) -- Golden eggs
setwindow("Golden Egg") -- using name instead of ID
setwindow(204228) -- Egg pet small hoe, for pet harvesting
setwindow("Poison Powder") -- poison powder
Works perfectly for me, just to much hassle when GM's whisper you to actually farm eggs.yoyodoggg wrote:does your gm userfunction kick in and log you off when they do?
Users browsing this forum: Bing [Bot] and 25 guests