Change exp Per Hour in Window title

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Change exp Per Hour in Window title

#41 Post by rock5 » Thu Sep 08, 2011 7:08 am

Talking about saving space, aren't the displays a bit lengthy? Also I wouldn't mind seeing a total as well as a per hour value.

Maybe instead of

Code: Select all

Item name: Golden Eggs per hour:5.5 Time Passed: 2
We could have something like

Code: Select all

Golden Eggs: 11 (5.5/h) Time passed: 2
More information, less space. What do you think?

I couldn't think of a shorter way to write "Time passed" unfortunately.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Change exp Per Hour in Window title

#42 Post by lisa » Thu Sep 08, 2011 7:52 am

Something like this

Code: Select all

sprintf(_charname.." ".._itemname..": "
			.._currentitems.." (".._itemsperhour.."/h) Time(h): ".._printtime)
7 + 1 + 10 + 2 + ? + 2 + 4 + 11 + 3
? is item count, so assume 2 which would be <=99, 3 for 100+
Looking at a maximum of 42 characters.

Pic is max width with 42 characters, only goes half way. so 42 is probably going to be ok.
printed 42 characters.
printed 42 characters.
Actual print of 20 Herb of Hope
actual print out of Herb of Hope, 20 items
actual print out of Herb of Hope, 20 items
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Change exp Per Hour in Window title

#43 Post by lisa » Thu Sep 08, 2011 8:14 am

Only thing I don't like atm is it stays blank for first 30 seconds, maybe call the function where the timer starts?

Code: Select all

		registerTimer("setwindow", secondsToTimer(30), _window);
		yrest(1000)
		_window()
Needed a 1 sec rest so it had a + value for the time difference. Works though.

current Version looks like this

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
Getting tired so going to leave it there, might play with it some more tomorrow nite but I think it is looking pretty good.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Change exp Per Hour in Window title

#44 Post by rock5 » Thu Sep 08, 2011 8:30 am

Looking good but if it's going to be a general purpose function maybe 30 seconds is too long?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Yoder
Posts: 24
Joined: Tue Sep 06, 2011 10:24 am

Re: Change exp Per Hour in Window title

#45 Post by Yoder » Thu Sep 08, 2011 9:16 am

So is your goal here to pre-define all settings or just the main formatting? I think this would be most usefull if you could define the Items being tracked and the string defining them in the window title.

But you guys really took off with this idea :) I guess I cant call it mine anymore LOL

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Change exp Per Hour in Window title

#46 Post by rock5 » Thu Sep 08, 2011 9:40 am

The idea is you can call this function to track any item. For example in a millers waypoint file you could have it track Golden eggs.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Change exp Per Hour in Window title

#47 Post by rock5 » Thu Sep 08, 2011 9:45 am

If you make the timer faster you will probably want to not use RoMScript commands. Use "inventory.Money" instead.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Yoder
Posts: 24
Joined: Tue Sep 06, 2011 10:24 am

Re: Change exp Per Hour in Window title

#48 Post by Yoder » Thu Sep 08, 2011 2:57 pm

Im currently running an older version at home with the hours calculation attached.

Ill go through the numbers today after 5 but it seemed itwas working. I started it at 1:00 last night then Ill let you know if the calculations are correct. keep in mind the time is in 10ths and 100ths not 60th's so it looks very confusion some times

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Change exp Per Hour in Window title

#49 Post by lisa » Thu Sep 08, 2011 7:41 pm

the time is tracked in 0.00 hours and 0.01 is actually 36 seconds, i just rounded to 30. So every time you see the time tick over you know the info has been updated. It won't change /hour value and not change time. Well when you get to 10 hours 10.0(4 characters) it will but by then I doubt you would care about 30 second updates.
rock5 wrote:Use "inventory.Money" instead.
Yeah I should, pretty much copy pasted my gold tracker userfunction code for that, code I did like 6+ months ago.
Yoder wrote:But you guys really took off with this idea
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 while ;)
Yoder wrote:So is your goal here to pre-define all settings or just the main formatting?
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.

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
I should mention just in case, only have 1 in the WP onload, using more then one will just result in the first 1 being stopped, it will only ever have the last 1 called running.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Yoder
Posts: 24
Joined: Tue Sep 06, 2011 10:24 am

Re: Change exp Per Hour in Window title

#50 Post by Yoder » Fri Sep 09, 2011 8:23 am

The Hourly Calculation seems to be fairly close after 24 hours I had 110 eggs with an averavge per hour of 4.6

Have to remember that it was 24. 0(some numbers) and the average was 4.6(some numbers)

But I assume the math would be correct if I checked it. right now it looked dead on.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Change exp Per Hour in Window title

#51 Post by lisa » Fri Sep 09, 2011 8:57 pm

Wish I could run 24hours in millers on my server, after an hour I get GM's whispering me to say hi lol
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

yoyodoggg
Posts: 34
Joined: Mon Aug 22, 2011 8:54 pm

Re: Change exp Per Hour in Window title

#52 Post by yoyodoggg » Sat Sep 10, 2011 12:57 pm

does your gm userfunction kick in and log you off when they do?

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Change exp Per Hour in Window title

#53 Post by lisa » Sat Sep 10, 2011 4:50 pm

yoyodoggg wrote:does your gm userfunction kick in and log you off when they do?
Works perfectly for me, just to much hassle when GM's whisper you to actually farm eggs.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 25 guests