Change exp Per Hour in Window title

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
Yoder
Posts: 24
Joined: Tue Sep 06, 2011 10:24 am

Change exp Per Hour in Window title

#1 Post by Yoder » Tue Sep 06, 2011 10:44 am

Can I add something to my waypoints to make Rom bot show in the window title what Ive gathered so far vs how much exp Ive earner

Idealy I would have it say

RoM Bot Player****(Gathered #Number Gathered# "Item monitored")

Item monitored could be staticaly assigned so only 1 number would change

Currently it says something like

RoM Bot Player**** (exp ####/HR)

Not at home rite now but I think Thats about right.

This could be used to monitor items gathered using Harvest waypoints, Gold for Clops KS, and Eggs too. Im sure their are other uses.

Please let me know if this is already available otherwise if it can be made

Yoder

kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Change exp Per Hour in Window title

#2 Post by kanta » Tue Sep 06, 2011 1:02 pm

Check this thread started by Lisa:

http://www.solarstrike.net/phpBB3/viewt ... =27&t=2034

It tracks some character info and gold gained. Maybe you could modify it for what you want.
Scout/Knight/Rogue 70/66/66

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

Re: Change exp Per Hour in Window title

#3 Post by Yoder » Tue Sep 06, 2011 2:37 pm

This could work for what I want.

If I can find where the current window title is defined I can work from there.

Any help please,

Thanks
Yoder

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

Re: Change exp Per Hour in Window title

#4 Post by Yoder » Tue Sep 06, 2011 3:59 pm

Code: Select all

	-- Set window name, install timer to automatically do it once a second
	local displayname = string.sub(load_profile_name, 1, 4) .. "****";
	setWindowName(getHwnd(), sprintf("RoM Bot %s [%s]", BOT_VERSION, displayname));
	settings.loadProfile(load_profile_name);
	settingsPrintKeys();		-- print keyboard settings to MM and log
	registerTimer("timedSetWindowName", secondsToTimer(1), timedSetWindowName, load_profile_name);
	player.BotStartTime_nr = os.time();	-- remember bot start time no reset
	player.level_detect_levelup = player.Level;	-- remember actual player level

	store = CStore()
Ok,

Ive found this in bot.lua and I think this is where it is setting the window name (probably why it says set window name) can I change this in a profile after its been set? or would I need to edit it here to make it an option first?

I was thinking their would need to be an option to read Inventory rather than read EXP.

Not asking for it to be done for me tho, Id like to work through this and actually see it happen, so just lookin for a nudge in the right direction here

Yoder

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

Re: Change exp Per Hour in Window title

#5 Post by Yoder » Tue Sep 06, 2011 7:58 pm

Code: Select all

local LAST_PLAYER_X = 0;
local LAST_PLAYER_Z = 0;
function timedSetWindowName(profile)
	local displayname = string.sub(profile, 1, 4) .. "****";
	if( (player.X ~= LAST_PLAYER_X) or (player.Z ~= LAST_PLAYER_Z) ) then
		setWindowName(getHwnd(), sprintf(language[600],
		BOT_VERSION, displayname, player.X, player.Z, player.ExpPerMin, player.TimeTillLevel));

		LAST_PLAYER_X = player.X;
		LAST_PLAYER_Z = player.Z;
	end
end
So where is the formula for player.ExpPerMin and player.TimeTillLevel

I assume as this refreshes when player coords change that this is where I want to make my changes

Now I can use help XD

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

Re: Change exp Per Hour in Window title

#6 Post by lisa » Tue Sep 06, 2011 8:36 pm

Code: Select all

		setWindowName(getHwnd(), sprintf(language[600],
		BOT_VERSION, displayname, player.X, player.Z, player.ExpPerMin, player.TimeTillLevel));
This is what is doing the text on your window, alter that and you alter what is being shown.

This should change the text to I like monkeys

Code: Select all

setWindowName(getHwnd(), "I like monkeys")
Does that help you?
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

#7 Post by rock5 » Tue Sep 06, 2011 9:21 pm

To put this into practic, I wonder if you could just replace the timedSetWindowName function somewhere in your own code. Then when the timer calls for it, it runs your version. I don't know if that would work but it's worth trying.
  • 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

#8 Post by Yoder » Tue Sep 06, 2011 10:27 pm

Code: Select all

storecharinfo(player.Name,"Eggs,"..inventory:itemTotalCount(204792)..",Cakes,"..inventory:itemTotalCount(204791))
So I have the addon working to store the character info, but how can I use this same string to show counts on the window

Code: Select all

setWindowName(getHwnd(), sprintf(language[600],
      BOT_VERSION, displayname, player.X, player.Z, player.ExpPerMin, player.TimeTillLevel));
This is good string of code and if I could repurpose the calculations and put them into a new addon much like the first string of code has its own addon, then I could end up with something like

Code: Select all

if( os.difftime(os.time(), self.LastExpUpdateTime) > self.ExpUpdateInterval ) then
		--local newExp = RoMScript("GetPlayerExp()") or 0;	-- Get newest value
		--local maxExp = RoMScript("GetPlayerMaxExp()") or 1; -- 1 by default to prevent division by zero

		local newExp = self.XP or 0;
		local maxExp = memoryReadRepeat("intptr", getProc(), addresses.charMaxExpTable_address, (self.Level-1) * 4) or 1;

		self.LastExpUpdateTime = os.time();					-- Reset timer

		if( type(newExp) ~= "number" ) then newExp = 0; end;
		if( type(maxExp) ~= "number" ) then maxExp = 1; end;
Where Exp calculations would be changed to be Item per hour, with the variable that you desire being set at the beginning of a waypoint

My problem is I dont know LUA at all yet and simply reading through code and mashing it together is tedious.

Ill keep at it, but does anyone know if I can define my own variables within my own addon?

something like

WaypointType = gather
namevar1 = monitored item 1
namevar2 = monitored Item 2
GatherItem1 = inventory:itemTotalCount(204792)
GatherItem2 = inventory:itemTotalCount(204791))

For example Below is not working code

Code: Select all

setWindowName(player.Name,"namevar1,"..GatherItem1..",namevar2,"..GatherItem2))
You could monitor the Waypoint file to see if its Gather or Level and then it would change the window readout accordingly

If you could define variables you could make a new variable using the ExpPerMin calcualtions as well

Code: Select all

self.ItemPerMin = ItemGainSum / ( valueCount * self.ItemUpdateInterval / 60 );
This is all in theory, but by making a calc like that with some added new variables you could then calulate gold herbs eggs cards daily items and monitor them using rombot obviously you could use ItemGainSum exported to a list to quickly calculate totals if you like too.


And thats my whole idea currently XD

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

Re: Change exp Per Hour in Window title

#9 Post by lisa » Tue Sep 06, 2011 10:56 pm

try

Code: Select all

setWindowName(getHwnd(),sprintf(player.Name.." "..GatherItem1.." "..GatherItem2))
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

#10 Post by Yoder » Tue Sep 06, 2011 11:06 pm

Sigh still no worky :(

dont I need to define the variables tho

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

Re: Change exp Per Hour in Window title

#11 Post by lisa » Tue Sep 06, 2011 11:13 pm

sorry forgot the print and didn't check the ()

Code: Select all

setWindowName(getHwnd(),sprintf(player.Name.." "..GatherItem1.." "..GatherItem2))

I assumed you had done the code for

Code: Select all

GatherItem1 =
and

Code: Select all

GatherItem2 =
already.
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

#12 Post by Yoder » Tue Sep 06, 2011 11:16 pm

Interesting

attempt to concatenate global 'gatherItem2' (a nil value)

how do I define these variables

GatherItem 1 and 2

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

Re: Change exp Per Hour in Window title

#13 Post by Yoder » Tue Sep 06, 2011 11:18 pm

O.o nice with the fast responses

thats what I thought but was getting errors

Seems this is working.

So I assume I can then pull the calc function out of the Player.lua and remanufacture it to meet my needs while defining variables?


Thanks for the help so far

Yoder

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

Re: Change exp Per Hour in Window title

#14 Post by Yoder » Tue Sep 06, 2011 11:24 pm

Strange I can define static values but Im guessing im typing this wrong.

I want the values to be

GatherItem2 = inventory:itemTotalCount(204792)

but when I enter it like that I get the error

Inventory (a nil value)

I thought this was reading the inventory and making a count. doesnt the inventory update on startup ?

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

Re: Change exp Per Hour in Window title

#15 Post by lisa » Tue Sep 06, 2011 11:29 pm

Sorry I thought you had it mostly done, you just needed to know how to implement it.

Code: Select all

local GatherItem1 = inventory:itemTotalCount(208473) -- lvl 66 health pot
local GatherItem2 = inventory:itemTotalCount(208480) -- lvl 66 mana pot
setWindowName(getHwnd(),sprintf(player.Name.."health pots: "..GatherItem1.." mana pots: "..GatherItem2))
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

#16 Post by lisa » Tue Sep 06, 2011 11:31 pm

also there was a patch recently and the new addresses haven't been found yet, I am surprised you can do anything with bot =)
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

#17 Post by Yoder » Tue Sep 06, 2011 11:33 pm

I was busy today :) bot is working and addressing for eggs seems ok now so thats why I was using them

I tested the readouts using the original linked script and was receving correct numbers

But Ill have to stop here for the night

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

Re: Change exp Per Hour in Window title

#18 Post by Yoder » Wed Sep 07, 2011 9:52 am

Good Morning :)

So here is what Ive thought about

Code: Select all

local GatherItem1 = inventory:itemTotalCount(208473) -- lvl 66 health pot
local GatherItem2 = inventory:itemTotalCount(208480) -- lvl 66 mana pot
local ItemPerMin1 = GatherItem1 / ( valueCount * self.ExpUpdateInterval / 60 ); --This should still work
local ItemPerMin2 = GatherItem2 / ( valueCount * self.ExpUpdateInterval / 60 ); -- to calculate per min 
local LAST_PLAYER_X = 0; 
local LAST_PLAYER_Z = 0;
function timedSetWindowName(profile)
	local displayname = string.sub(profile, 1, 4) .. "****";
	if( (player.X ~= LAST_PLAYER_X) or (player.Z ~= LAST_PLAYER_Z) ) then
		setWindowName(getHwnd(),sprintf(player.Name.."health pots: "..GatherItem1.." mana pots: "..GatherItem2));

		LAST_PLAYER_X = player.X;
		LAST_PLAYER_Z = player.Z;
	end
end
But I get an error when starting the bot,

Code: Select all

[b]5: attempt to index global 'inventory' (a nil value)[/b]
[/color]

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

Re: Change exp Per Hour in Window title

#19 Post by lisa » Wed Sep 07, 2011 10:06 am

I am guessing this is in functions.lua around line 400?

2 things come to mind

first is that classes/inventory.lua hasn't been loaded yet which is why it is returning inventory as nil.

the other is something else has gone wrong, there must be more to the error message. what else did it say?
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

#20 Post by rock5 » Wed Sep 07, 2011 10:10 am

Where did you put the code? Or did you just edit the existing code?

If you edited the existing code, 'inventory' may not have been defined yet. I don't see any way around it.

But I think you could put this somewhere where it will be called after the bot has started, such as a userfunction or in an event such as an 'onload' event. It would then overwrite the existing code and inventory would already exist.
  • 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

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 17 guests