a long time ago in chapter 2. i had a bot that traded with another bot to exceed the limit of how many volcano mud dailies i could loot in a day, i found that script cleaning up my waypoints folder (246 files >_<) and it give me an idea.
i happen to play on the US servers, where the GMs don't know or don't care i bot (im assuming the latter) ive run dogmeat bots 24/7 for litterally 9+ months so far with no suspensions, ive even helped players debug there boths and walk people through svn updating in trade chat.
so all the comments about how this bot is a bad idea on principle of risk or stupidity really don't apply in my specific case.
but enough of my pre-rant it is my intention to make a bot that stands next to the charge vendor in varanas and opens his portable mailbox and withdraws vast sums of belts. while another bot stands in limo and just locks up this characters mailbox with infinite belts.
this part is simple, however this bots function will be when the trade window pops up. to open it and fill the window with belts and accept the trade.
here is the tricky part:
i want this bot to run 24/7 and be open to the public, in order for this to be realistic i need to limit how many times this bot is willing to open the trade window with a player of the same name. which means i need to construct some kind of variable database or flatfile that records the names of every player who trades with me and the time, and then removes them from that list every 24 hours or so, or more effectively attach a listclearing function to a OnEvent call for dailies to reset or something.
i allso personally would like to do this with a character at dogmeats, and provide every player on the server with a free stack of dogmeats everyday as my server currently has under 100 players and i farm dogmeats on all 3 channels.
so rather than ask rock and lisa to spoon feed me, could you just point me in the direction of how i would go about drawing information from a flatfile, i did a few forum searches but other than some of rocks work on trading bots i havent pulled up much relevant to a bot as specific as this.
Concept: Gift Bot,Trading bot,NPC bot.
Re: Concept: Gift Bot,Trading bot,NPC bot.
The actual trading is easy enough so I will discuss the tracking players issue.
You could add info to a table in the WP easy enough but if for some reason the bot needs restarting then all previous trade info is lost. So you will probably need to look at saving the info to a log file and then reading from the log file when determining if the character has received dogmeat that day.
You should probably add a check for the other chars level aswell or someone might just teleport 20 alts to the spot and get 20 stacks off you a day.
Saving the data to a file is easy enough.
filename defines the name, you could have it set like this 1 or you could have the name change as a variable, probably better for your situation is to set it to the date. So that each day is a new file and you don't need to worry about deleting data.
The "a+" means it adds data to the end of the file.
You then add info to the file with file:write()
using \n at the end so the next info added goes to next line, charname is the name of the character you are trading with.
then you just need to close the file when done with that character, to make sure data isn't lost.
If you save the data in the same format as the WP files you could use similar code for reading the data.
filename is the name of the file obviously.
well hopefully this info helps anyway =)
You could add info to a table in the WP easy enough but if for some reason the bot needs restarting then all previous trade info is lost. So you will probably need to look at saving the info to a log file and then reading from the log file when determining if the character has received dogmeat that day.
You should probably add a check for the other chars level aswell or someone might just teleport 20 alts to the spot and get 20 stacks off you a day.
Saving the data to a file is easy enough.
Code: Select all
filename = getExecutionPath() .. "/logs/pawnlog.xml";
file, err = io.open(filename, "a+");
if( not file ) then
error(err, 0);
end
The "a+" means it adds data to the end of the file.
You then add info to the file with file:write()
Code: Select all
file:write('name="'..charname..'"\n')
then you just need to close the file when done with that character, to make sure data isn't lost.
Code: Select all
file:close();
filename is the name of the file obviously.
Code: Select all
local root = xml.open(filename);
if( not root ) then
error(sprintf("Failed to load data from \'%s\'", filename), 0);
end
local elements = root:getElements();
for i,v in pairs(elements) do
local name = v:getAttribute("name")
--check name against current player trying to trade.
end
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

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Who is online
Users browsing this forum: Bing [Bot] and 5 guests