-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#1
Post
by sdude13 » Wed Sep 07, 2011 3:20 pm
For the current event it's nice to login with every character and get the story-buff.
before login next tron i'd like to print it to a file.
So after all characters are done, i can check the list an login the correct character.
How can I actually print the right buff to the file (not all buffs if possible only the story buff).
Waypoint
Code: Select all
player:target_NPC(119137);
player:rest(2);
sendMacro("ChoiceOption(2);"); -- get Buff
player:rest(2);
player:update();
local filename = getExecutionPath() .. "/logs/buffs.log";
local file, err = io.open(filename, "a+");
if file then
file:write(" Character name: " ..player.Name.. ". \tDate: " .. os.date() .. ". \t Buff: ".. THEBUFF .. "\n")
file:close();
end
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
player = CPlayer.new();
settings.load();
settings.loadProfile("xxxxxx");
loadPaths("xxxx");
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#2
Post
by lisa » Wed Sep 07, 2011 6:57 pm
untested but something like this, not sure if the buff is story or Story, could probably make it lower I guess then it won't matter.
userfunction
Code: Select all
function logbuffevent()
local filename = getExecutionPath() .. "/logs/eventbuff.log";
local file, err = io.open(filename, "a+");
for i, buff in pairs(player.Buffs) do
if string.find("story", string.lower(buff)) then
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " Buff: "..buff.."\n")
file:close();
end
end
end
end
in WP
Code: Select all
logbuffevent()
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
This is under the assumption the buff has "story" in it, I can't remember if it does or not.
If it doesn't then you will need to create a table of all of the buff names and do a search of the buff names against the players current buffs. Little bit more involved but still very doable.
-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#3
Post
by sdude13 » Thu Sep 08, 2011 12:59 am
thx so far, however i get the problem with the table:
[string "..."]:6: bad argument #1 to 'lower' (string expected, got table)
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#4
Post
by rock5 » Thu Sep 08, 2011 1:05 am
- 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.”
-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#5
Post
by sdude13 » Thu Sep 08, 2011 1:23 am
no error but also no output:
i changed to:
Code: Select all
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " Buff: "..buff.Name.."\n")
that seems to work
if i disable the
Code: Select all
if if string.find("erz", string.lower(buff.Name)) then
The buff has a German Special character its called "Erzählerisches Element..."
so i tryed with "erz" and "Erz".. but none working.
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#6
Post
by lisa » Thu Sep 08, 2011 1:42 am
In english they used
Story Element
Maybe we can just do check for Element:
Also I didn't realise buff wasn't the actual name, so this should work
Code: Select all
function logbuffevent()
local filename = getExecutionPath() .. "/logs/eventbuff.log";
local file, err = io.open(filename, "a+");
for i, buff in pairs(player.Buffs) do
if string.find("Element:", buff.Name) then
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " Buff: "..buff.Name.."\n")
file:close();
end
end
end
end
I did concider getting a list of all the buff id's but when I logged lots of alts and got buffs I got to over 10 different names before i stopped counting.
There is probably a list in the US forums regarding buff names and how many.
-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#7
Post
by sdude13 » Thu Sep 08, 2011 1:47 am
no, it seems it does not search in the String.
"Element" is not working.
I'll be away for some hours now. will try to get it work when back.
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#8
Post
by lisa » Thu Sep 08, 2011 1:55 am
Sorry had it backwards for the search =(
Tested and works.
Code: Select all
function logbuffevent()
local filename = getExecutionPath() .. "/logs/eventbuff.log";
local file, err = io.open(filename, "a+");
for i, buff in pairs(player.Buffs) do
printf(buff.Name.."\n")
if string.find(buff.Name , "Element") then
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " \tBuff: "..buff.Name.."\n")
file:close();
end
end
end
end
file print looks like this
Code: Select all
Character name: XXXXX Date: 09/08/11 16:54:00 Buff: Story Element: Innocent Girl
-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#9
Post
by sdude13 » Thu Sep 08, 2011 6:52 am
I will test it, when back at my gaming pc. I guess it works here too,
so thank you in advance !
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#10
Post
by lisa » Thu Sep 08, 2011 7:01 am
there are 3 mage buffs with Element in the name, so you may get some stray prints to the file. Wouldn't be many though.
-
sdude13
- Posts: 76
- Joined: Thu Aug 19, 2010 9:36 am
#11
Post
by sdude13 » Thu Sep 08, 2011 3:21 pm
its working.
how can I add the current logged in "account name" to the character ?
I've seen that in some post here but did not find it any more.
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#12
Post
by lisa » Thu Sep 08, 2011 7:50 pm
wiki
So in the bot it would be like this
Code: Select all
accountname = sendMacro("GetAccountName()")
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests