Where do I place the code snippet from the Wiki-XP per Hr

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Leopardfist
Posts: 11
Joined: Mon Oct 19, 2009 3:27 pm

Where do I place the code snippet from the Wiki-XP per Hr

#1 Post by Leopardfist » Tue Oct 27, 2009 12:29 pm

I found the snippet of code from the wiki for showing exp per hour, and I understand it goes into the bot.lua script, but where in the script should I paste it?

I have line numbers in my VS turned on, so you can give me a line number area and tell me before such and such or whatever. Id LOVE to have this ability, but dont wanna mess around with the script blindly.

Thanks!

<EDIT>

i TRIED PLACING THE CODE INTO THE BOT.LUA SCRIPT AND GOT AN ERROR FOR THE LAST LINE OF CODE.

'>' expected near 'expPerMin'

It could also be a ')', cant really tell.

The code I used is:

Code: Select all

local expGained = 0;
local startTime = os.time();
local lastAnnounce = os.time();
 
local lastTotalExp = 0;
while(true) do
  local newTotalExp = memoryReadInt(proc, experienceaddr, experience_offset);
  if( newTotalExp > lastTotalExp ) then
    expGained = expGained + (newTotalExp - lastTotalExp);
  end
 
  -- has 10 seconds elapsed? update the exp/min
  if( os.difftime(os.time(), lastAnnounce) > 10 ) then
    local timeElapsed = os.difftime(os.time(), startTime);
    local expPerMin = 0;
    if( timeElapsed == 0 ) then timeElapsed = 1; end; -- prevent division by zero
 
    expPerMin = expGained/(timeElapsed/60.0);
    lastAnnounce = os.time();
    printf("Exp/min: %0.1f\n" expPerMin);
  end
 
end

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#2 Post by d003232 » Tue Oct 27, 2009 1:46 pm

Leopardfist wrote:

Code: Select all

printf("Exp/min: %0.1f\n" expPerMin);
That line should be

Code: Select all

printf("Exp/min: %0.1f\n", expPerMin);
The RoM Bot Online Wiki needs your help!

Leopardfist
Posts: 11
Joined: Mon Oct 19, 2009 3:27 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#3 Post by Leopardfist » Tue Oct 27, 2009 8:22 pm

OK, now I get the error:

scripts\rom/bot.lua:466: Wrong number of parameters supplied to memoryReadInt().

Code: Select all

 local newTotalExp = memoryReadInt(proc, experienceaddr, experience_offset);

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#4 Post by d003232 » Wed Oct 28, 2009 1:47 am

Leopardfist wrote:OK, now I get the error:

scripts\rom/bot.lua:466: Wrong number of parameters supplied to memoryReadInt().

Code: Select all

 local newTotalExp = memoryReadInt(proc, experienceaddr, experience_offset);
I don't know, what you want to do with that coding? It's not from/for the RoM Bot. There are no memory adresses for 'experience' defined. Perhaps you should look for a ingame addon?
The RoM Bot Online Wiki needs your help!

Leopardfist
Posts: 11
Joined: Mon Oct 19, 2009 3:27 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#5 Post by Leopardfist » Wed Oct 28, 2009 11:04 am

d003232 wrote:
Leopardfist wrote:OK, now I get the error:

scripts\rom/bot.lua:466: Wrong number of parameters supplied to memoryReadInt().

Code: Select all

 local newTotalExp = memoryReadInt(proc, experienceaddr, experience_offset);
I don't know, what you want to do with that coding? It's not from/for the RoM Bot. There are no memory adresses for 'experience' defined. Perhaps you should look for a ingame addon?

It's from your Wiki!

http://www.solarstrike.net/wiki/index.p ... e=Snippets

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#6 Post by d003232 » Wed Oct 28, 2009 11:58 am

Leopardfist wrote:It's from your Wiki!

http://www.solarstrike.net/wiki/index.p ... e=Snippets
That are examplex how to do some tasks with the micromacro environment. But they are no ready to use within the RoM Bot, perhaps they are even not usefull or practicable within the bot.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#7 Post by Administrator » Wed Oct 28, 2009 12:36 pm

That code there is meant to be a general example. If I remember correctly, some user asked about how to do that in another game, for which I provided that example.

If you can provide offsets for exp/total exp, I can add this to the bot.

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#8 Post by j_schlott » Wed Nov 04, 2009 8:23 pm

im not sure how i would find offsets, but theres functions to return current exp and max exp

Code: Select all

GetPlayerExp()
GetPlayerMaxExp()

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Where do I place the code snippet from the Wiki-XP per Hr

#9 Post by Administrator » Thu Nov 05, 2009 4:56 pm

This has been added in r394.

Post Reply

Who is online

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