Create log file for waypoint
Create log file for waypoint
I want to make a log file for my elfdaily script.
At the end of the daily i want to put in that log file:
Charname: Level: Phirius Coins:
and that for each character in same file, after dailys on a new line.
How can i do this? preferably in a CSV format with ; as seperator. but if XML is only way, im good with that too
At the end of the daily i want to put in that log file:
Charname: Level: Phirius Coins:
and that for each character in same file, after dailys on a new line.
How can i do this? preferably in a CSV format with ; as seperator. but if XML is only way, im good with that too
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
Would this work?
Code: Select all
local filename = getExecutionPath() .. "/logs/elfs.log";
local file, err = io.open(filename, "a+");
coins = inventory:itemTotalCount("Phirius Token Coin")
if file then
file:write(" Character name: " ..player.Name.. " \tDate: " .. os.date() .. " \Phirius Coins:"..coins.."\n")
file:close();
end
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
And i answer my question myself,
yes it does
Sorry for opening this totally useless post
Maybe somebody can use the code tho...
OneofMany
yes it does
Sorry for opening this totally useless post
Maybe somebody can use the code tho...
OneofMany
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
and changed it to:
now i can just open the logfile at the end of the day to see if i got enough tokens , even with excel for better visual
Code: Select all
local filename = getExecutionPath() .. "/logs/elfs.log";
local file, err = io.open(filename, "a+");
coins = inventory:itemTotalCount("Phirius Token Coin")
if file then
file:write("Karakter:\t".. player.Name .."\tDate:\t" .. os.date() .."\tLevel:\t".. player.Level .."\tPhirius Coins:\t".. coins ..
"\n")
file:close();
end
Last edited by OneofMany on Tue Nov 01, 2011 4:46 am, edited 5 times in total.
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
Yep that is exactly how you do 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
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Create log file for waypoint
Thnx to ur cot_tele waypoint with log
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
how to specify a location in the file where you want to write it matter?
Re: Create log file for waypoint
It just starts at the end of file each time, if that is what you want to know?
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
I want to write the value for example on line 5 column 1 pos 1
Re: Create log file for waypoint
remember that its just a text file, that, can be converted to excel using text to columns.
I think you want to fill in an excel form?
maybe try putting some enters and ; in the line. then you will get to youre desired position. Will only work once tho...
I think you want to fill in an excel form?
maybe try putting some enters and ; in the line. then you will get to youre desired position. Will only work once tho...
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
code from bot.lua
contents of the file mail.xml
I want to make this command all the time edited the ninth line
Code: Select all
keyboardBufferClear();
io.stdin:flush();
cprintf(cli.green, "\130\162\165\164\168\226\165 \173\174\172\165\224 \231\160\224\160 \173\160\231\168\173\160\239 \225 \170\174\226\174\224\174\163\174 \173\227\166\173\174 \174\226\175\224\160\162\171\239\226\236 \175\168\225\236\172\160")
text = io.stdin:read();
filename = getExecutionPath() .. "/waypoints/Mail.xml";
file, err = io.open(filename, "a");
file:write("\Account = "..text.."\n")
file:close();
I want to make this command all the time edited the ninth line
Code: Select all
<waypoints type="TRAVEL">
<onLoad>
repeat zoneid = RoMScript("GetZoneID()") until zoneid
if zoneid == 13 then __WPL:setWaypointIndex(__WPL:findWaypointTag("day"))
end
waitForLoadingScreen(3);
player:update();
name = "name"
Account = 1;
Charcount = 1;
pass = 0;
pass2={"pass2","pass2","pass2"};
fastLoginAccNames={"Names","Names","Names","Names","Names","Names"};
sendMacro("}fastLoginLoggedIn=false;a={");
yrest(100);
sendMacro("}fastLoginAutoEnter=true;a={");
yrest(100);
sendMacro("}fastLoginAutoLogin=true;a={");
yrest(100);
sendMacro("}fastLoginRelog=true;a={");
yrest(100);
sendMacro("}fastLoginNoZoom=true;a={");
</onLoad>
</waypoints>
Last edited by D1mAnn on Wed Nov 02, 2011 2:23 am, edited 2 times in total.
Re: Create log file for waypoint
For this ill pass ur question needs a more pro to answer
Its not about cheating. Its about being smarter than the game...
Re: Create log file for waypoint
Ok so if I understand correctly you want to run bot.lua which will ask you a question, I didn't understand the language but I assume it was account name.
Then you want to write the file mail.xml and making line 9 to be
Account =
and then the text you type into MM after the question is asked.
I couldn't find a way to edit a perticular line when I looked about 9 months ago.
What I did was create my own .lua and have it print each line but adjust the text I wanted.
So basically I did a
and so on, for line 9 I would do your.
You could probably do some \n and \t and just do some long lines to reduce the number of file:write but I just found it easier to do each line so I can easily fix any issues or changes that needed making.
I did it to automake profiles, the writes looked like this.
Should give you an idea of 1 way to do it, there is probably an easier way.
Then you want to write the file mail.xml and making line 9 to be
Account =
and then the text you type into MM after the question is asked.
I couldn't find a way to edit a perticular line when I looked about 9 months ago.
What I did was create my own .lua and have it print each line but adjust the text I wanted.
So basically I did a
Code: Select all
file:write("<waypoints type=\"TRAVEL\">")
file:write("<onLoad>")
Code: Select all
file:write("\Account = "..text.."\n")
I did it to automake profiles, the writes looked like this.
Code: Select all
file:write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
file:write("<profile>\n\t<options>\n\n");
file:write("\t\t<option name=\"INV_AUTOSELL_ENABLE\" value=\"true\" />\n");
file:write("\t\t<option name=\"INV_AUTOSELL_FROMSLOT\" value=\"0\" />\n");
file:write("\t\t<option name=\"INV_AUTOSELL_TOSLOT\" value=\"60\" />\n");
file:write("\t\t<option name=\"INV_AUTOSELL_QUALITY\" value=\"white,green\" />\n");
file:write("\t\t<option name=\"INV_AUTOSELL_IGNORE\" value=\"potion, Rough Wooden Bow\" />\n\n");
file:write("\t\t<option name=\"HP_LOW\" value=\"85\" />\n");
file:write("\t\t<option name=\"MP_LOW_POTION\" value=\"70\" />\n");
file:write("\t\t<option name=\"HP_LOW_POTION\" value=\"70\" />\n");
file:write("\t\t<option name=\"USE_HP_POTION\" value=\"best\" />\n");
file:write("\t\t<option name=\"USE_MANA_POTION\" value=\"best\" />\n\n");
file:write("\t\t<option name=\"HP_REST\" value=\"15\" />\n");
file:write("\t\t<option name=\"MP_REST\" value=\"15\" />\n\n");
file:write("\t\t<!-- Shopping options, how many of what do you want to keep in your inventory -->\n");
file:write("\t\t<option name=\"HEALING_POTION\" value=\"99\" />\n");
file:write("\t\t<option name=\"MANA_POTION\" value=\"" .. mpuser .. "\" />\n");
file:write("\t\t<option name=\"ARROW_QUIVER\" value=\"" .. buyarrows .. "\" />\n");
file:write("\t\t<option name=\"THROWN_BAG\" value=\"0\" />\n");
file:write("\t\t<option name=\"POISON\" value=\"0\" />\n");
file:write("\t\t<!-- either false or arrow or thrown -->\n");
file:write("\t\t<option name=\"RELOAD_AMMUNITION\" value=\"" .. reloadamu .. "\" /> <!-- false|arrow|thrown -->\n\n");
file:write("\t\t<!-- Combat options -->\n");
file:write("\t\t<option name=\"COMBAT_TYPE\" value=\"\" /> <!-- leave empty or choose ranged/melee if not using class default -->\n");
file:write("\t\t<option name=\"COMBAT_RANGED_PULL\" value=\"" .. ranged .. "\" /> <!-- only important for melees -->\n");
file:write("\t\t<option name=\"COMBAT_DISTANCE\" value=\"150\" />\n");
file:write("\t\t<option name=\"MAX_FIGHT_TIME\" value=\"15\" /> <!-- Max time without damage before break -->\n");
file:write("\t\t<option name=\"DOT_PERCENT\" value=\"90\" />\n");
file:write("\t\t<option name=\"ANTI_KS\" value=\"true\" />\n");
file:write("\t\t<option name=\"MAX_TARGET_DIST\" value=\"200\" />\n\n");
file:write("\t\t<!-- Attack monsters 3 levels above or 10 below your level -->\n");
file:write("\t\t<option name=\"TARGET_LEVELDIF_ABOVE\" value=\"3\" />\n");
file:write("\t\t<option name=\"TARGET_LEVELDIF_BELOW\" value=\"10\" />\n\n");
file:write("\t\t<!-- Waypoint and movement settings -->\n");
file:write("\t\t<option name=\"WAYPOINTS\" value=\"1-10human/travel1-10\" /> <!-- leave empty to show a list -->\n");
file:write("\t\t<option name=\"RETURNPATH\" value=\"1-10human/travel1-10_return\" />\n");
file:write("\t\t<option name=\"PATH_TYPE\" value=\"waypoints\" /> <!-- waypoints | wander -->\n");
file:write("\t\t<option name=\"WANDER_RADIUS\" value=\"500\" />\n");
file:write("\t\t<option name=\"WAYPOINT_DEVIATION\" value=\"0\" />\n");
file:write("\t\t<option name=\"QUICK_TURN\" value=\"false\" />\n\n");
file:write("\t\t<!-- Loot settings -->\n");
file:write("\t\t<option name=\"LOOT\" value=\"true\" />\n");
file:write("\t\t<option name=\"LOOT_IN_COMBAT\" value=\"true\" />\n");
file:write("\t\t<option name=\"LOOT_DISTANCE\" value=\"150\" />\n");
file:write("\t\t<option name=\"LOOT_PAUSE_AFTER\" value=\"0\" /> <!-- probability in % for a short rest -->\n\n");
file:write("\t\t<!-- Harvest options -->\n");
file:write("\t\t<option name=\"HARVEST_DISTANCE\" value=\"50\" />\n");
file:write("\t\t<option name=\"HARVEST_WOOD\" value=\"true\" /> <!-- Choose which types to harvest. -->\n");
file:write("\t\t<option name=\"HARVEST_HERB\" value=\"true\" /> <!-- \"true\" = harvest, \"false\" = do not harvest -->\n");
file:write("\t\t<option name=\"HARVEST_ORE\" value=\"true\" />\n\n");
file:write("\t\t<!-- Eggpet options -->\n");
file:write("\t\t<option name=\"EGGPET_ENABLE_CRAFT\" value=\"false\" /><!-- If using same slot for assist and craft, onlt 1 can be enabled. -->\n");
file:write("\t\t<option name=\"EGGPET_CRAFT_SLOT\" value=\"1\" />\n");
file:write("\t\t<option name=\"EGGPET_ENABLE_ASSIST\" value=\"false\" />\n");
file:write("\t\t<option name=\"EGGPET_ASSIST_SLOT\" value=\"1\" />\n");
file:write("\t\t<option name=\"EGGPET_CRAFT\" value=\"mining,woodworking,herbalism\" /> <!-- 'mining', 'woodworking', 'herbalism' or combination. -->\n");
file:write("\t\t<option name=\"EGGPET_CRAFTINDEX\" value=\"\" /> <!-- The level to craft. \"\" defaults to maximum -->\n\n");
file:write("\t\t<!-- Log out and resurrect settings -->\n");
file:write("\t\t<option name=\"LOGOUT_TIME\" value=\"0\" /> <!-- in minutes, 0 = timer disabled -->\n");
file:write("\t\t<option name=\"LOGOUT_SHUTDOWN\" value=\"false\" />\n");
file:write("\t\t<option name=\"LOGOUT_WHEN_STUCK\" value=\"true\" />\n");
file:write("\t\t<option name=\"RES_AFTER_DEATH\" value=\"true\" />\n");
file:write("\t\t<option name=\"MAX_DEATHS\" value=\"10\" /> <!-- Log out after this many deaths -->\n\n");
file:write("\t\t<!-- For more options and documentation see the RoM Bot Wiki: -->\n");
file:write("\t\t<!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot -->\n\n");
file:write("\t</options>\n\n");
file:write("\t<friends>\n");
file:write("\t\t<!-- names of friends we help fighting or enemys we don't want to attack -->\n");
file:write("\t\t<friend name=\"MyOtherCharacter1\" />\n");
file:write("\t\t<friend name=\"MyOtherCharacter2\" />\n");
file:write("\t\t<friend name=\"Elite_Mob_Name1\" />\n");
file:write("\t\t<friend name=\"Elite_Mob_Name2\" />\n");
file:write("\t</friends>\n\n");
file:write("\t<mobs>\n");
file:write("\t\t<!-- names of mobs we want to attack -->\n");
file:write("\t\t<!-- if no names defined we will attack all mobs -->\n");
file:write("\t\t<mob name=\"\" />\n");
file:write("\t\t<mob name=\"\" />\n");
file:write("\t\t<mob name=\"\" />\n");
file:write("\t</mobs>\n\n");
file:write("\t<hotkeys>\n");
file:write("\t\t<!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->\n");
file:write("\t\t<hotkey name=\"MACRO\" modifier=\"\" key=\"VK_0\" />\n");
file:write("\t</hotkeys>\n\n");
file:write("\t<skills" .. _charclass2 .. ">\n");
if _mainskill ~= nil then file:write("\t\t<skill name=\"" .. _mainskill .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskillkey .. "\" priority=\"" .. _mainskillpriority .. "\" />\n"); end
if _mainskill2 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill2 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill2key .. "\" priority=\"" .. _mainskill2priority .. "\" />\n"); end
if _mainskill3 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill3 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill3key .. "\" priority=\"" .. _mainskill3priority .. "\" />\n"); end
if _mainskill4 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill4 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill4key .. "\" priority=\"" .. _mainskill4priority .. "\" />\n"); end
if _main2skill ~= nil then file:write("\t\t<skill name=\"" .. _main2skill .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skillkey .. "\" priority=\"" .. _main2skillpriority .. "\" />\n"); end
if _main2skill2 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill2 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill2key .. "\" priority=\"" .. _main2skill2priority .. "\" />\n"); end
if _main2skill3 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill3 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill3key .. "\" priority=\"" .. _main2skill3priority .. "\" />\n"); end
if _main2skill4 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill4 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill4key .. "\" priority=\"" .. _main2skill4priority .. "\" />\n"); end
file:write("\t</skills" .. _charclass2 .. ">\n\n");
file:write("\t<skills" .. _charclass .. ">\n");
if _mainskill ~= nil then file:write("\t\t<skill name=\"" .. _mainskill .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskillkey .. "\" priority=\"" .. _mainskillpriority .. "\" />\n"); end
if _mainskill2 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill2 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill2key .. "\" priority=\"" .. _mainskill2priority .. "\" />\n"); end
if _mainskill3 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill3 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill3key .. "\" priority=\"" .. _mainskill3priority .. "\" />\n"); end
if _mainskill4 ~= nil then file:write("\t\t<skill name=\"" .. _mainskill4 .. "\" modifier=\"\" hotkey=\"VK_" .. _mainskill4key .. "\" priority=\"" .. _mainskill4priority .. "\" />\n"); end
if _main2skill ~= nil then file:write("\t\t<skill name=\"" .. _main2skill .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skillkey .. "\" priority=\"" .. _main2skillpriority .. "\" />\n"); end
if _main2skill2 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill2 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill2key .. "\" priority=\"" .. _main2skill2priority .. "\" />\n"); end
if _main2skill3 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill3 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill3key .. "\" priority=\"" .. _main2skill3priority .. "\" />\n"); end
if _main2skill4 ~= nil then file:write("\t\t<skill name=\"" .. _main2skill4 .. "\" modifier=\"\" hotkey=\"VK_" .. _main2skill4key .. "\" priority=\"" .. _main2skill4priority .. "\" />\n"); end
file:write("\t</skills" .. _charclass .. ">\n\n");
file:write("\t\t<onDeath><![CDATA[\n\n");
file:write("\t\t]]></onDeath>\n\n");
file:write("\t\t<onLeaveCombat><![CDATA[\n\n");
file:write("\t\t]]></onLeaveCombat>\n\n");
file:write("\t\t<onLevelup><![CDATA[\n\n");
file:write("\t\t\ttylvlskill();\n\n");
file:write("\t\t\tcheckskilllvl();\n\n");
file:write("\t\t\topenbags1To10();\n\n");
file:write("\t\t\tstorecharname();\n\n");
file:write("\t\t]]></onLevelup>\n\n");
file:write("\t\t<onSkillCast><![CDATA[\n\n");
file:write("\t\t]]></onSkillCast>\n\n");
file:write("\t\t<onHarvest><![CDATA[\n\n");
file:write("\t\t]]></onHarvest>\n\n");
file:write("\t\t<onLoad><![CDATA[\n\n");
file:write("\t\t\tcheckskilllvl();\n\n");
file:write("\t\t\tsetranged();\n\n");
file:write("\t\t\tsetactionbar();\n\n");
file:write("\t\t\tstorecharname();\n\n");
file:write("\t\t]]></onLoad>\n\n");
file:write("</profile>");
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
Re: Create log file for waypoint
ok so that was to answer your question about altering a write to a file.
Now if I was to try to do what you want I would be looking at creating another argument for rom/bot.lua
Ok so it looks for : in the argument, and then checks for path,profile,character,retpath.
So maybe add in another check and make it your account name/number.
Add in a
when you start bot use
Obviously replace **** with what you wanted
then in your WP onload have
Now if I was to try to do what you want I would be looking at creating another argument for rom/bot.lua
Ok so it looks for : in the argument, and then checks for path,profile,character,retpath.
So maybe add in another check and make it your account name/number.
Code: Select all
if( var == "profile" ) then
forcedProfile = val;
elseif( var == "path" ) then
forcedPath = val;
elseif( var == "retpath" ) then
forcedRetPath = val;
elseif( var == "character") then
forcedCharacter = val;
else
-- invalid option
local msg = sprintf(language[61], args[i]);
error(msg, 0 );
end
Code: Select all
elseif( var == "account" ) then
AccountName = val;
Code: Select all
rom/bot account:****
then in your WP onload have
Code: Select all
Account = AccountName
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
Re: Create log file for waypoint
thank you, if you have to do so is another question, how to set the encoding of ANSI as UTF-8(utf82oem_russian)? by default it saves in ANSI
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Create log file for waypoint
Use a better editor. Try Notepad++.D1mAnn wrote:thank you, if you have to do so is another question, how to set the encoding of ANSI as UTF-8(utf82oem_russian)? by default it saves in ANSI
Re: Create log file for waypoint
ok, see I run the Bat file it contains
in mail.lua contains the string at the end of
how to make the first window closes after the micromacro input values thx
Code: Select all
@echo off
START micromacro.exe scripts/rom/mail.lua
Code: Select all
os.execute("START micromacro.exe scripts/rom/bot.lua update profile:DF_Pr path:mail.xml")
- Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
Re: Create log file for waypoint
use system() instead of os.execute(), maybe?
Re: Create log file for waypoint
You do not understandAdministrator wrote:use system() instead of os.execute(), maybe?
I want to exit the micromacro, I do not know what command exit them
sorry for my terrible English, I use Google translator
Code: Select all
os.exit()
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: Create log file for waypoint
I was reading through some posts today and I saw this one and it got me to thinking... If we were to write a piece of code that would record in a log file where you walk, what you battle, what NPC you talk to and the choices you make, including the wait time between talking, the items you loot, etc..., this log file could then be used as a reference file to create waypoints.
My thinking is that if I had code to record this, I could go to the start point of what quests I want to create waypoints for, start the "recorder" and then go about my business doing some quests. Suppose I do some normal, non-daily quests and gain 5 levels. Then I stop the "recorder," and then go about building a waypoint using the log file that was created. If I were able to record all that information, then creating the waypoint for those specific quests would not only be easier to do (because you have all the info in front of you), but it would also be customized because the waypoint will be a copy of my own personal style of play and look much less like a typical bot.
Then if you could create code that would automatically parse the log file to dynamically create the waypoint file, we'd be golden. All you'd have to do is go in and tweak any areas that have problems.
Thoughts?
My thinking is that if I had code to record this, I could go to the start point of what quests I want to create waypoints for, start the "recorder" and then go about my business doing some quests. Suppose I do some normal, non-daily quests and gain 5 levels. Then I stop the "recorder," and then go about building a waypoint using the log file that was created. If I were able to record all that information, then creating the waypoint for those specific quests would not only be easier to do (because you have all the info in front of you), but it would also be customized because the waypoint will be a copy of my own personal style of play and look much less like a typical bot.
Then if you could create code that would automatically parse the log file to dynamically create the waypoint file, we'd be golden. All you'd have to do is go in and tweak any areas that have problems.
Thoughts?
Who is online
Users browsing this forum: No registered users and 1 guest