tracking player name // time // WP // level and now gold

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

tracking player name // time // WP // level and now gold

#1 Post by lisa »

Little userfunction I just made up, it stores character details in files in your profiles folder.

--
Ver 1.0 stores name and time stamp.
Ver 1.1 also stores Wp file and lvl.
--

It adds a new line to the end each time it's used.

function name is

Code: Select all

storecharname()
Suguested places to use would be onload of character profile and also added after code of changing character

Code: Select all

sendMacro("}LoginNextToon=true;a={")
         sendMacro("Logout();"); yrest(3*60*1000)
         
         player = CPlayer.new();
         settings.load();
         storecharname()

It allows for multi botting, add in a variable between the (). I was thinking along the lines of account name but it can be anything you want.

if nothing is between () then it creates file aalastcharWP.xml

if say XX between () then it creates file aalastcharWPXX.xml

I deliberately named it with aa so as to keep it at top of folder for easy finding.

Add the file to your rom/userfunctions folder.

Also added a gold tracker
----------
V 1.1
----------
Prints on MM window

Code: Select all

Current gold: 15062
Profit: 0
Elapsed time: 63.035 minutes.
Profit per hour: 0
and also logs data to a file in your profile folder. Might look at changing time posted to be in hours after reaching a time for easier reading.

Call the function in your WP onload to set start time, and then call the function again from your WP just after repairing/selling.

Code: Select all

 goldtracker()
Attachments
userfunction_GoldTracker.lua
Gold Tracker V 1.2
Fixed per hour calculations
(1.06 KiB) Downloaded 455 times
addon_charnameWP.lua
Ver 1.1
(520 Bytes) Downloaded 410 times
Last edited by lisa on Mon May 23, 2011 7:39 pm, edited 9 times in total.
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: tracking player name and time

#2 Post by lisa »

Just an example of the output, I ran my 1-10/10, copied output when it was lvl 7. I can see it took 34 mins for 2-7 and which WP it was on when it lvled.
I obviously replaced char name with XXX.

Code: Select all

 Character name "XXX" waypoint file "ty1.xml" date "01/12/11 17:43:44" player lvl "2"
 Character name "XXX" waypoint file "ty3.xml" date "01/12/11 17:47:19" player lvl "3"
 Character name "XXX" waypoint file "ty3.xml" date "01/12/11 17:51:36" player lvl "4"
 Character name "XXX" waypoint file "ty4.xml" date "01/12/11 18:00:12" player lvl "5"
 Character name "XXX" waypoint file "ty5.xml" date "01/12/11 18:07:52" player lvl "6"
 Character name "XXX" waypoint file "ty8.xml" date "01/12/11 18:17:15" player lvl "7"
Anyone tried it out yet??
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
Othon1001
Posts: 8
Joined: Wed Jan 12, 2011 4:24 am

Re: tracking player name and time

#3 Post by Othon1001 »

Thanks for your script

I'm trying probably this evening

exactly what i need :D
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: tracking player name and time

#4 Post by lisa »

Happy to be of help =)
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
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: tracking player name // time // WP // level

#5 Post by jduartedj »

You should Add this to the User Functions Repository.
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: tracking player name // time // WP // level

#6 Post by lisa »

I considered it but since it's only been downloaded twice, it didn't seem like there was enough interest to add it.
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
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: tracking player name // time // WP // level

#7 Post by jduartedj »

there is always a point and interest, believe me! Anyway no function is more important the another! please post it!
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
Othon1001
Posts: 8
Joined: Wed Jan 12, 2011 4:24 am

Re: tracking player name // time // WP // level

#8 Post by Othon1001 »

I'm modify your script for my owne utility

Code: Select all

if( settings == nil ) then
	include("settings.lua");
end

function storecharinfo(nameplayer,msg)

if nameplayer == nil then nameplayer = "" end

	filename = getExecutionPath() .. "/profiles/aalastcharWP" .. nameplayer .. ".xml";

	file, err = io.open(filename, "a+");
	if( not file ) then
		error(err, 0);
	end


file:write(" Character name \"" ..nameplayer.. "\" waypoint file \"" .. __WPL.FileName .. "\" date \"" .. os.date()); 
file:write("\" Message \"" .. msg .. "\"\n");

file:close();
end
for utilisation

Code: Select all

storecharinfo(player.Name,"Phirius :"..inventory:itemTotalCount(203038))

Thanks a lot for your script
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: tracking player name // time // WP // level

#9 Post by lisa »

nice idea to use it to track how many phirius tokens you have =)
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
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: tracking player name // time // WP // level

#10 Post by jduartedj »

Or just anything you pass in the second arg!
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates
Othon1001
Posts: 8
Joined: Wed Jan 12, 2011 4:24 am

Re: tracking player name // time // WP // level

#11 Post by Othon1001 »

My final addon_charinfoWP.lua

Code: Select all

if( settings == nil ) then
	include("settings.lua");
end

function storecharinfo(nameplayer,msg)

if nameplayer == nil then nameplayer = "" end

	filename = getExecutionPath() .. "/logs/" .. nameplayer .. ".log";

	file, err = io.open(filename, "a+");
	if( not file ) then
		error(err, 0);
	end


file:write(nameplayer.. "," .. os.date().. "," .. msg .. "\n");

file:close();
end
Utilisation for phirius

Code: Select all

 storecharinfo(player.Name,",Phirius,"..inventory:itemTotalCount(203038)) 
Utilisation for eggs

Code: Select all

 storecharinfo(player.Name,"Eggs,"..inventory:itemTotalCount(204792)..",Cakes,"..inventory:itemTotalCount(204791))
information in logs/NAME.log (it's csv file type)

Code: Select all

NAMEPLAYER,DATE,Phirius,3600
little script in perl for extraction information from log file

Code: Select all

 
#!/usr/bin/perl -w
use strict;

my $READDIR="..//logs";

opendir(DIR,"$READDIR") or die "Can't opendir $!";
my @READHD=readdir(DIR);
close DIR;

my $totalphirius=0;
my $totaleggs=0;
my $totalcakes=0;

foreach my $File (@READHD) {
	next if ($File eq ".");
	next if ($File eq "..");
	if ($File=~m/\.log$/)	{
		open(MYFILE,$READDIR."//".$File);
		my @array=<MYFILE>;
		close (MYFILE);
		my $numline=@array;
		my $numprintline = $numline - 1 ;
		while($numprintline != $numline) {
			print "$array[$numprintline]" ;
			if ( $array[$numprintline]=~m/Phirius/ ) {
				my ($a,$b,$c,$nbr)=split(/,/,$array[$numprintline]);
				$totalphirius = $totalphirius + $nbr; 
				$numprintline++;
			} elsif ( $array[$numprintline]=~m/Egg/ ) {
				my ($a,$b,$c,$nbreggs,$d,$nbrcakes)=split(/,/,$array[$numprintline]);
				$totaleggs = $totaleggs + $nbreggs;
				$totalcakes = $totalcakes + $nbrcakes;
				$numprintline++;
			} else {
				$numprintline++;
			}
		}
	}
}

print "Total : ".$totalphirius." Phirius ".($totalphirius/30)." Charges\n";
print "Total : ".$totaleggs." Golden Eggs ".$totalcakes." Cakes\n";
ouput from this script

Code: Select all

Total : XXX Phirius XXX Charges
Total : XXX Golden Eggs XXX Cakes
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: tracking player name // time // WP // level

#12 Post by lisa »

Wow, I can see my little userfunction has been helpful in getting you started for something you really wanted to utilise =)

Very nice usage by the way.
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: tracking player name // time // WP // level

#13 Post by lisa »

Your usage actually got me thinking, I have always wanted an item tracking addon like I used to have when playing wow called altoholic.
I am thinking I could use an onload in the profile to save all bag info to a file and then use something similar with your pearl to make it searchable.

Might take some time to get it all organised though, have to plan best way to organise the info first.
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: tracking player name // time // WP // level

#14 Post by rock5 »

Maybe you could make use of the Inventory Viewer addon that does that.
  • 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: tracking player name // time // WP // level

#15 Post by lisa »

I'll check it out, thanks

That addon works pretty good, I'd like a way to check items out of RoM though, not high on my priority list atm. Might look into doing it in a few weeks.
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
Rom Botter
Posts: 85
Joined: Wed Jul 21, 2010 11:05 am
Location: Holland

Re: tracking player name // time // WP // level

#16 Post by Rom Botter »

Othon1001 wrote:My final addon_charinfoWP.lua

Code: Select all

if( settings == nil ) then
	include("settings.lua");
end

function storecharinfo(nameplayer,msg)

if nameplayer == nil then nameplayer = "" end

	filename = getExecutionPath() .. "/logs/" .. nameplayer .. ".log";

	file, err = io.open(filename, "a+");
	if( not file ) then
		error(err, 0);
	end


file:write(nameplayer.. "," .. os.date().. "," .. msg .. "\n");

file:close();
end
Utilisation for phirius

Code: Select all

 storecharinfo(player.Name,",Phirius,"..inventory:itemTotalCount(203038)) 
Utilisation for eggs

Code: Select all

 storecharinfo(player.Name,"Eggs,"..inventory:itemTotalCount(204792)..",Cakes,"..inventory:itemTotalCount(204791))
information in logs/NAME.log (it's csv file type)

Code: Select all

NAMEPLAYER,DATE,Phirius,3600
little script in perl for extraction information from log file

Code: Select all

 
#!/usr/bin/perl -w
use strict;

my $READDIR="..//logs";

opendir(DIR,"$READDIR") or die "Can't opendir $!";
my @READHD=readdir(DIR);
close DIR;

my $totalphirius=0;
my $totaleggs=0;
my $totalcakes=0;

foreach my $File (@READHD) {
	next if ($File eq ".");
	next if ($File eq "..");
	if ($File=~m/\.log$/)	{
		open(MYFILE,$READDIR."//".$File);
		my @array=<MYFILE>;
		close (MYFILE);
		my $numline=@array;
		my $numprintline = $numline - 1 ;
		while($numprintline != $numline) {
			print "$array[$numprintline]" ;
			if ( $array[$numprintline]=~m/Phirius/ ) {
				my ($a,$b,$c,$nbr)=split(/,/,$array[$numprintline]);
				$totalphirius = $totalphirius + $nbr; 
				$numprintline++;
			} elsif ( $array[$numprintline]=~m/Egg/ ) {
				my ($a,$b,$c,$nbreggs,$d,$nbrcakes)=split(/,/,$array[$numprintline]);
				$totaleggs = $totaleggs + $nbreggs;
				$totalcakes = $totalcakes + $nbrcakes;
				$numprintline++;
			} else {
				$numprintline++;
			}
		}
	}
}

print "Total : ".$totalphirius." Phirius ".($totalphirius/30)." Charges\n";
print "Total : ".$totaleggs." Golden Eggs ".$totalcakes." Cakes\n";
ouput from this script

Code: Select all

Total : XXX Phirius XXX Charges
Total : XXX Golden Eggs XXX Cakes

where do i put the script to extract the data from the logs?

and this script also works when the bot is still running?? e.g i dont have to alt tab to game to check eggs and cakes, i can just run that lua script and it will extract the info for me?
I think people need to be educated on the fact the marijuana is NOT a drug... marijuana is a plant and an herb, GOD put it here... if GOD put it here, what gives the GOVERNMENT the right to say GOD is WRONG??? ~ Willie Nelson
swietlowka
Posts: 316
Joined: Wed Jun 16, 2010 8:16 am

Re: tracking player name // time // WP // level

#17 Post by swietlowka »

lisa, if u are going to make something like itemviewer addon it could be great because the original file gets erased a lot (imho), one that would be outside SaveVariables.lua would mean a lot to me ;)
acctualy i would somehow like all the addons to be stored in an outside file, because of the above glitch...
reading the data outside of rom would also be nice though...

and i really would like to read thru the log file in search for certain words and items...
so id like also knwo like rom botter how exactly do i run the perl code?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: tracking player name // time // WP // level

#18 Post by lisa »

the pearl code and such was created by Othon1001, I haven't tested it as yet.
Had a lot on my plate lately.
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: tracking player name // time // WP // level

#19 Post by lisa »

Trouble I find with inventory viewer which is the same for all addons that save data is this.
They use the RoM functions VARIABLES_LOADED and SAVE_VARIABLES and RoM isn't designed for multiple clients on the same machine. So each RoM client loads the data in savevariables.lua and save the data when called for but another client may have already saved their information after the last client loaded the information. So basically anything saved by the other client is lost.

This means that the info in savevariables.lua is basically useless to us as most of us would use more then 1 client.

I think to do this efficiently for our situation would require 1 of a couple of options.

1. rewrite the addon to save the data in a different file system using character names for different files so the data will never overwrite each other. Would take a while as would need to basically guess what the RoM functions are and create similar ones.

2. Write a whole new system for storing information similar to the userfunction that this topic is about and have the data accessible out of both RoM and MM, pretty much like what Othon1001 has done. I wouldn't save all the info that IV saves, that would take me months to write lol

3. I will no doubt come up with this option soonish and start playing around.


Option 1 sux and I'm not really interesting in going down that path.

Option 2 is the most viable and wouldn't be to difficult to do, to keep the information accurate it would need to be updated regularly, it could be setup to update on a timed interval but this would add to whats required to run each bot. If you did it onload then you would only get accurate info after first starting up bot which isn't ideal. If you used multiple machines then the info would only be accurate if you only used accounts perticular machines. You could prob set up the files to be saved in a shared folder though, that would work.

Ok getting to indepth here yet again, I've been told I over think things lol

Option 2 sounds best for now until I come up with option 3 =)
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: tracking player name // time // WP // level

#20 Post by rock5 »

Actually I think option 1 will have the same problem. If client 1 and client 2 are running and you close client 1, it will save new info under that characters name. But when you close client 2, because it hasn't got that info, when it saves its data I think it will still erase client 1s data.

Option 2 wouldn't be hard to do. Just a matter of collecting data from inventory, equipped gear etc. into a well structured table and just saving the whole thing to a file. I believe Administrator has now added a couple of functions for writing and reading tables to files in the last version of macromicro.

Code: Select all

table.save(  tbl,filename )
tbl = table.load( sfile )
The problems I foresee are:
1. What happens if more than 1 client tries to read/write to the file at the same time.
2. It's not just a matter of reading the data, you also have to consolidate the new data with the old. Might be a bit tricky but can be done.
  • 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