i just got the bot and need help getting it running

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

i just got the bot and need help getting it running

#1 Post by jver422 » Sun Jan 30, 2011 10:39 am

rom/settings.lua:291: bad argument #1 to 'upper' (string exspected got nil)

that is my current error messege and here is the line refered to:
local keyname;
if( string.upper(v.key) == "MACRO" ) then
keyname = "MACRO";



what should i edit to make this work?

Oldcoot
Posts: 14
Joined: Mon Jan 17, 2011 1:43 pm

Re: i just got the bot and need help getting it running

#2 Post by Oldcoot » Sun Jan 30, 2011 4:29 pm

check out the RomBot post above your post here, instructions are there, should help you a lot.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: i just got the bot and need help getting it running

#3 Post by lisa » Sun Jan 30, 2011 9:06 pm

First thing I'd look at is your profile for this.

Code: Select all

		<hotkey name="MACRO"        modifier="" key="VK_0" />
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

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#4 Post by jver422 » Mon Jan 31, 2011 1:34 pm

lisa wrote:First thing I'd look at is your profile for this.

Code: Select all

		<hotkey name="MACRO"        modifier="" key="VK_0" />

OK i found this it's line 100 now what? and thank you so much for your help :D
the last forum i was in i posted 14 times and got nothing. so i came to the source :mrgreen:

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

Re: i just got the bot and need help getting it running

#5 Post by Administrator » Mon Jan 31, 2011 3:51 pm

It could be any of the hotkeys in your profile. One of them is unset.

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#6 Post by jver422 » Mon Jan 31, 2011 10:01 pm

Administrator wrote:It could be any of the hotkeys in your profile. One of them is unset.
Meaning what? What hotleys must be set? Are we talking about the action bar? Do I need to list every attack I have on it? I'm sorrry if this seems very stupid of me I'm new to this and in my profile I got rid of all the attacks because I was just going to use it for the golden eggs. So I'll go into my profile tomorrow and remap my skills in there and see how it goes

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: i just got the bot and need help getting it running

#7 Post by lisa » Mon Jan 31, 2011 10:18 pm

anything in your profile that has VK_
So all the skills and anything in the

Code: Select all

	<hotkeys>

	</hotkeys>
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

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#8 Post by jver422 » Tue Feb 01, 2011 10:04 am

im in the middle of maping my skills on my account now, where it says modifier is that where i put the lvl of the skill? such as

Code: Select all

<skill name="SCOUT_VAMPIRE_ARROWS" modifier="39" hotkey="VK_3" priority="100" />

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: i just got the bot and need help getting it running

#9 Post by JackBlonder » Tue Feb 01, 2011 10:12 am

Modifier means the key to additionaly press to use the skill.
Example:
Skill is used by pressing ALT+4
Your profile must be set to

Code: Select all

modifier="VK_ALT" hotkey="VK_4"
You can read more about it at the rombot wiki:
http://www.solarstrike.net/wiki/index.p ... le=RoM_Bot

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#10 Post by jver422 » Tue Feb 01, 2011 10:17 am

oh ok thanks for the quick reply

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#11 Post by jver422 » Tue Feb 01, 2011 11:03 am

im still getting the same error messege

rom/settings.lua:291: bad argument #1 to 'upper' (string exspected got nil)

what should i do?

ill post the whole file that this comes from if you need to look at it

Code: Select all

settings_default = {
	hotkeys = {
		MOVE_FORWARD = {key = _G.key.VK_W, modifier = nil},
		MOVE_BACKWARD = {key = _G.key.VK_S, modifier = nil},
		ROTATE_LEFT = {key = _G.key.VK_A, modifier = nil},
		ROTATE_RIGHT = {key = _G.key.VK_D, modifier = nil},
		STRAFF_LEFT = {key = _G.key.VK_Q, modifier = nil},
		STRAFF_RIGHT = {key = _G.key.VK_E, modifier = nil},
		JUMP = {key = _G.key.VK_SPACE, modifier = nil},
		TARGET = {key = _G.key.VK_TAB, modifier = nil},
		TARGET_FRIEND = {key = _G.key.J, modifier = nil},
		START_BOT = {key = _G.key.VK_DELETE, modifier = nil},
		STOP_BOT = {key = _G.key.VK_END, modifier = nil}
	},
	options = {
		ENABLE_FIGHT_SLOW_TURN = false,
		MELEE_DISTANCE = 45,
		LANGUAGE = "english",
		USE_CLIENT_LANGUAGE = true,		-- automatic use client language after loading the bot
		DEBUGGING = false,
		DEBUGGING_MACRO = false,
		ROMDATA_PATH = nil,
	},
	profile = {
		options = {
			-- common options
			HP_LOW = 85,
			MP_LOW_POTION = 50,
			HP_LOW_POTION = 40,
			COMBAT_TYPE = "melee",
			COMBAT_RANGED_PULL = "true",	-- only for melee classes , use ranged skill to pull
			COMBAT_DISTANCE = 200,
			ANTI_KS = true,
			WAYPOINTS = "demo.xml",
			RETURNPATH = nil,
			PATH_TYPE = "waypoints",
			WANDER_RADIUS = 500,
			WAYPOINT_DEVIATION = 0,
			LOOT = true,
			LOOT_TIME = 2000,
			LOOT_AGAIN = 2000,				-- second loot try if rooted after x ms
			LOOT_IN_COMBAT = true,
			LOOT_DISTANCE = nil,
			LOOT_PAUSE_AFTER = 10,			-- probability in % for short pause after loot to look more human
			HARVEST_DISTANCE = 120,
			HARVEST_WOOD = true,
			HARVEST_HERB = true,
			HARVEST_ORE = true,
			MAX_FIGHT_TIME = 12,
			DOT_PERCENT = 90,
			LOGOUT_TIME = 0,
			LOGOUT_SHUTDOWN = false,
			LOGOUT_WHEN_STUCK = true,
			MAX_UNSTICK_TRIALS = 10,
			TARGET_LEVELDIF_BELOW = 99,
			TARGET_LEVELDIF_ABOVE = 99,
			QUICK_TURN = false,
			MP_REST = 15,
			HP_REST = 15,
			RES_AUTOMATIC_AFTER_DEATH = false,	-- automatic resurrect after death true|false,
			HEALING_POTION = 0,				-- shopping options, how many to buy/have in inventory
			MANA_POTION = 0,				-- shopping options, how many to buy/have in inventory
			ARROW_QUIVER = 0,				-- shopping options, how many to buy/have in inventory
			THROWN_BAG = 0,					-- shopping options, how many to buy/have in inventory
			POISON = 0,						-- shopping options, how many to buy/have in inventory
			EGGPET_HOE = 0,					-- shopping options, how many to buy/have in inventory
			EGGPET_SPADE = 0,				-- shopping options, how many to buy/have in inventory
			EGGPET_HATCHET = 0,				-- shopping options, how many to buy/have in inventory
			RELOAD_AMMUNITION = false,		-- false|arrow|thrown
			EGGPET_ENABLE_CRAFT = false,
			EGGPET_CRAFT_SLOT = nil,
			EGGPET_ENABLE_ASSIST = false,
			EGGPET_ASSIST_SLOT = nil,
			EGGPET_CRAFT_RATIO = "1:1:1",	-- mining:woodworking:herbalism ratio to use when crafting. '0' means do not craft that type.
			EGGPET_CRAFT_INDEXES = ",,",	-- Index level override for mine:wood:herb eg. ",,1" will only create index level 1 herb items


			-- expert options
			MAX_SKILLUSE_NODMG = 3,				-- maximum casts without damaging the target before break it
			MAX_TARGET_DIST = 250,			-- maximum distance to select a target (helpfull to limit at small places)
			AUTO_ELITE_FACTOR = 5,			-- mobs with x * your HP value counts as 'Elite' and we will not target it
			AUTO_TARGET = true,				-- bot will target mobs automaticly (set it to false if you want to use the bot only as fight support)
			SKILL_GLOBALCOOLDOWN = 1200,	-- Global Skill Use Cooldown (1000ms) we use a little more
			SKILL_USE_PRIOR = "auto",			-- cast x ms before cooldown is finished
			PK_COUNTS_AS_DEATH = true,		-- count playerkill's as death
			POTION_COOLDOWN = 15,			-- always 15
			POTION_COOLDOWN_HP = 0,			-- will only be used if not 0, if 0 POTION_COOLDOWN will be used
			POTION_COOLDOWN_MANA = 0,		-- will only be used if not 0, if 0 POTION_COOLDOWN will be used
			SIT_WHILE_RESTING = false,		-- sit while using the rest function
			USE_MANA_POTION = "best",		-- which mana potion type to use: best | minstack
			USE_HP_POTION = "best",			-- which HP potion type to use: best | minstack
			WAYPOINTS_REVERSE = false,		-- use the waypoint file in reverse order
			WAYPOINT_PASS = 100,			-- skip a waypoint if we pass in distance x while fighting a mob (go to as melee)
			WAYPOINT_PASS_DEGR = 90,		-- skip a waypoint if we touched one and the next is at least x degrees in front
			MAX_DEATHS = 10,				-- maximal death if automatic resurrect befor logout
			WAIT_TIME_AFTER_RES = 8000,		-- time to wait after resurrection, needs more on slow PCs
			RETURNPATH_SUFFIX = "_return",	-- suffix for default naming of returnpath
			HARVEST_SCAN_WIDTH = 5,			-- steps horizontal
			HARVEST_SCAN_HEIGHT = 5,		-- steps vertical
			HARVEST_SCAN_STEPSIZE = 60,		-- wide of every step
			HARVEST_SCAN_TOPDOWN = false,	-- true = top->down  false = botton->up
			HARVEST_SCAN_XMULTIPLIER = 1.0,	-- multiplier for scan width
			HARVEST_SCAN_YMULTIPLIER = 1.1,	-- multiplier for scan line height
			HARVEST_SCAN_YREST = 10,		-- scanspeed
			HARVEST_SCAN_YMOVE = 1.1,		-- move scan area top/down ( 1=middle of screen )
			HARVEST_TIME = 45,				-- how long we maximum harvest a node
			USE_SLEEP_AFTER_RESUME = false, -- enter sleep mode after pressing pause/resume key
			IGNORE_MACRO_ERROR = false, 	-- ignore missing MACRO hotkey error (only temporary option while beta)
			DEBUG_INV = false,	 			-- to help to find the item use error (only temporary option while beta)
			DEBUG_LOOT = false,	 			-- debug loot issues
			DEBUG_TARGET = false, 			-- debug targeting issues
			DEBUG_HARVEST = false, 			-- debug harvesting issues
			DEBUG_WAYPOINT = false, 		-- debug waypoint issues
			DEBUG_AUTOSELL = false, 		-- debug autosell issues

			-- debug skill use issues
			DEBUG_SKILLUSE = {
				ENABLE 		= false,
				TIMEGAP		= true,		-- show the time gap between cast starts
				ONCOOLDOWN	= true,		-- show the time in ms that we are before the cooldown
				NOCOOLDOWN	= true,		-- show the time in ms that we are over the cooldown
				HPLOW		= true
				},

			-- expert inventar
			INV_MAX_SLOTS = 60,	 			-- maximal slots to update in the inventory:update()
			INV_UPDATE_INTERVAL = 300,	 	-- full inventory update every x seconds (only used indirect atm)
			INV_AUTOSELL_ENABLE = false,	-- autosell items at merchant true|false
			INV_AUTOSELL_FROMSLOT = 0,		-- autosell from slot #
			INV_AUTOSELL_TOSLOT = 0,		-- autosell to slot #
			INV_AUTOSELL_QUALITY = "white",	-- itemcolors to sell
			INV_AUTOSELL_IGNORE = nil,		-- itemnames never so sell
			INV_AUTOSELL_NOSELL_DURA = 0,	-- durability > x will not sell, 0=sell all
			INV_AUTOSELL_STATS_NOSELL = nil,	-- stats (text search at right tooltip side) that will not be selled
			INV_AUTOSELL_STATS_SELL = nil,		-- stats (text search at right tooltip side) that will be selled, even if in nosell


		},
		hotkeys = {  },
		skills = {},
		friends = {},
		mobs = {},
		events = {
			onDeath = nil,
			onLoad = nil,
			onLeaveCombat = nil,
			onPreSkillCast = nil,
			onSkillCast = nil,
			onLevelup = nil,
			onHarvest = nil,
		}
	},
};

bot =	{ 		-- global bot values
		ClientLanguage,		-- ingame language of the game [ DE|RU|FR|ENUS|ENEU
		GetTimeFrequency,	-- calculated CPU frequency for calculating with the getTime() function
		LastSkillKeypressTime = getTime(),	-- remember last time we cast (press key)
		IgfAddon = false,	-- check if igf addon is active
		};


if( table.copy == nil ) then
	table.copy = function (_other)
		local t = {};
		for i,v in pairs(_other) do
			t[i] = v;
		end

		return t;
	end
end

settings = table.copy(settings_default);

check_keys = { name = { } };
function checkKeySettings( _name, _key, _modifier)
-- args are the VK in stringform like "VK_CONTROL", "VK_J", ..

	local hf_check_where;
	if( bindings ) then	-- keys are from bindings.txt
		hf_check_where = language[141];		-- Datei settings.xml
	else
		hf_check_where = language[140];		-- Ingame -> System -> Tastenbelegung
	end

	local msg = nil;
	-- no empty keys pls
	if( _key == nil) then
		msg = sprintf(language[115], _name);	-- key for \'%s\' is empty!
		msg = msg .. hf_check_where;
	end

	-- check if all keys are valid virtual keys (VK)
	if( _key ) then
		if( key[_key]  == nil  and
			string.upper(_key) ~= "MACRO" ) then	-- hotekey MACRO is a special case / it's not a virtual key
			msg = sprintf(language[116], _key, _name);	-- The hotkey ... is not a valid key
			msg = msg .. hf_check_where;
		end
	end;

	-- no modifiers allowed at the moment
	if( _modifier ) then
		if( key[_modifier]  == nil ) then
			msg = sprintf(language[117], _modifier, _name);	-- The modifier ... is not a valid key
			msg = msg .. hf_check_where;
		end
	end;

	-- now we check for double key settings
	-- we translate the strings "VK..." to the VK numbers
	if( string.upper(_key) ~= "MACRO" ) then
		_key = key[_key];
	end
	_modifier = key[_modifier];

	-- check the using of modifiers
	-- they are not usable at the moment

	-- error output
	if( msg ~= nil) then
		-- only a warning for TARGET_FRIEND / else an error
		if(_name == "TARGET_FRIEND") then
			cprintf(cli.yellow, msg .. language[119]);	-- can't use the player:target_NPC() function
		else
			error(msg, 0);
		end
	end

	-- check for double key settings
	for i,v in pairs(check_keys) do
		if( v.name ~= _nil and	-- empty entries from deleted settings.xml entries
		    v.key == _key  and
		    string.upper(_key) ~= "MACRO" and	-- hotkey MACRO is allowed to set more then once
		    v.modifier == _modifier ) then
			local modname;

			if( v.modifier ) then
				modname = getKeyName(v.modifier).."+";
			else
				modname = "";
			end;

			local errstr = sprintf(language[121],	-- assigned the key \'%s%s\' double
				modname,
				getKeyName(v.key),
				v.name, _name) ..
				hf_check_where;
			error(errstr, 0);
		end
	end;

	check_keys[_name] = {};
	check_keys[_name].name = _name;
	check_keys[_name].key = _key;
	check_keys[_name].modifier = _modifier;
end


function settingsPrintKeys()
-- That function prints the loaded key settings to the MM window and to the log

	local msg;
	msg ="QUICK_TURN = "..tostring(settings.profile.options.QUICK_TURN);	-- we wander around
	logMessage(msg);		-- log keyboard settings

	if( bindings ) then		-- we read from bindings.txt
		msg = sprintf(language[167], "bindings.txt");	-- Keyboard settings are from
	else				-- we read settings.xml
		msg = sprintf(language[167], "settings.xml");	-- Keyboard settings are from
	end

--	cprintf(cli.green, msg.."\n");	-- Keyboard settings are from
	logMessage(msg);		-- log keyboard settings

	for i,v in pairs(check_keys) do

		if(v.name) then

			msg = string.sub(v.name.."                               ", 1, 30);	-- function name

			local modname;
			if( v.modifier ) then
				modname = getKeyName(v.modifier).."+";	-- modifier name
			else
				modname = "";
			end;

			local keyname;
			if( string.upper(v.key) == "MACRO" ) then
				keyname = "MACRO";
			else
				keyname = getKeyName(v.key);
			end

			msg = msg..modname..keyname;	-- add key name
--			printf(msg.."\n");			-- print line
			logMessage(msg);			-- log keyboard settings

		end;
	end;

end


function settings.load()
	local filename = getExecutionPath() .. "/settings.xml";
	local root = xml.open(filename);
	local elements = root:getElements();
	check_keys = { };	-- clear table, because of restart from createpath.lua

	-- Specific to loading the hotkeys section of the file
	local loadHotkeys = function (node)
		local elements = node:getElements();
		for i,v in pairs(elements) do
			-- If the hotkey doesn't exist, create it.
			settings.hotkeys[ v:getAttribute("description") ] = { };
			settings.hotkeys[ v:getAttribute("description") ].key = key[v:getAttribute("key")];
			settings.hotkeys[ v:getAttribute("description") ].modifier = key[v:getAttribute("modifier")];

			if( key[v:getAttribute("key")] == nil ) then
				local err = sprintf(language[122],	-- does not have a valid hotkey!
				  v:getAttribute("description"));
				error(err, 0);
			end

			checkKeySettings( v:getAttribute("description"),
			  v:getAttribute("key"),
			  v:getAttribute("modifier") );
		end
	end

	local loadOptions = function (node)
		local elements = node:getElements();
		for i,v in pairs(elements) do
			settings.options[ v:getAttribute("name") ] = v:getAttribute("value");
		end
	end

	-- Load RoM keyboard bindings.txt file
	local function load_RoM_bindings_txt()
		local filename, file;

		local userprofilePath = os.getenv("USERPROFILE");
		local documentPaths = {
			userprofilePath .. "\\My Documents\\" .. "Runes of Magic", -- English
			userprofilePath .. "\\Eigene Dateien\\" .. "Runes of Magic", -- German
			userprofilePath .. "\\Mes Documents\\" .. "Runes of Magic", -- French
			userprofilePath .. "\\Omat tiedostot\\" .. "Runes of Magic", -- Finish
			userprofilePath .. "\\Belgelerim\\" .. "Runes of Magic", -- Turkish
			userprofilePath .. "\\Mina Dokument\\" .. "Runes of Magic", -- Swedish
			userprofilePath .. "\\Dokumenter\\" .. "Runes of Magic", -- Danish
			userprofilePath .. "\\Documenti\\" .. "Runes of Magic", -- Italian
			userprofilePath .. "\\Mijn documenten\\" .. "Runes of Magic", -- Dutch
			userprofilePath .. "\\Moje dokumenty\\" .. "Runes of Magic", -- Polish
			userprofilePath .. "\\Mis documentos\\" .. "Runes of Magic", -- Spanish
			userprofilePath .. "\\Os Meus Documentos\\" .. "Runes of Magic", -- Portuguese
		};

		-- Use a user-specified path from settings.xml
		if( settings.options.ROMDATA_PATH ) then
			table.insert(documentPaths, settings.options.ROMDATA_PATH);
		end

		-- Select the first path that exists
		for i,v in pairs(documentPaths) do
			if( string.sub(v, -1 ) ~= "\\" and string.sub(v, -1 ) ~= "/" ) then
				v = v .. "\\"; -- Append the trailing backslash if necessary.
			end

			local filename = v .. "bindings.txt";
			if( fileExists(filename) ) then
				file = io.open(filename, "r");
				local tmp = filename;
				cprintf(cli.green, language[123], filename);	-- read the hotkey settings from your bindings.txt
			end
		end

		-- If we wern't able to locate a document path, return.
		if( file == nil ) then
			return;
		end

		-- delete hotkeys from settings.xml in check table to avoid double entries / wrong checks
		check_keys["MOVE_FORWARD"] = nil;
		check_keys["MOVE_BACKWARD"] = nil;
		check_keys["ROTATE_LEFT"] = nil;
		check_keys["ROTATE_RIGHT"] = nil;
		check_keys["STRAFF_LEFT"] = nil;
		check_keys["STRAFF_RIGHT"] = nil;
		check_keys["JUMP"] = nil;
		check_keys["TARGET"] = nil;
		check_keys["TARGET_FRIEND"] = nil;

		-- Load bindings.txt into own table structure
		bindings = { name = { } };
		-- read the lines in table 'lines'
		for line in file:lines() do
			for name, key1, key2 in string.gfind(line, "(%w*)%s([%w+]*)%s*([%w+]*)") do
				bindings[name] = {};
				bindings[name].key1 = key1;
				bindings[name].key2 = key2;

				--settings.hotkeys[name].key =
			end
		end

		local function bindHotkey(bindingName)
			local links = { -- Links forward binding names to hotkey names
				MOVEFORWARD = "MOVE_FORWARD",
				MOVEBACKWARD = "MOVE_BACKWARD",
				TURNLEFT = "ROTATE_LEFT",
				TURNRIGHT = "ROTATE_RIGHT",
				STRAFELEFT = "STRAFF_LEFT",
				STRAFERIGHT = "STRAFF_RIGHT",
				JUMP = "JUMP",
				TARGETNEARESTENEMY = "TARGET",
				TARGETNEARESTFRIEND = "TARGET_FRIEND",
			};

			local hotkeyName = bindingName;
			if(links[bindingName] ~= nil) then
				hotkeyName = links[bindingName];
			end;


			if( bindings[bindingName] ~= nil ) then
				if( bindings[bindingName].key1 ~= nil ) then
					-- Fix key names
					bindings[bindingName].key1 = string.gsub(bindings[bindingName].key1, "CTRL", "CONTROL");

					if( string.find(bindings[bindingName].key1, '+') ) then
						local parts = explode(bindings[bindingName].key1, '+');
						-- parts[1] = modifier
						-- parts[2] = key

						settings.hotkeys[hotkeyName].key = key["VK_" .. parts[2]];
						settings.hotkeys[hotkeyName].modifier = key["VK_" .. parts[1]];
						checkKeySettings(hotkeyName, "VK_" .. parts[2], "VK_" .. parts[1] );
					else
						settings.hotkeys[hotkeyName].key = key["VK_" .. bindings[bindingName].key1];
						checkKeySettings(hotkeyName, "VK_" .. bindings[bindingName].key1 );
					end

				else
					local err = sprintf(language[124], bindingName);	-- no ingame hotkey for
					error(err, 0);
				end
			end
		end

		bindHotkey("MOVEFORWARD");
		bindHotkey("MOVEBACKWARD");
		bindHotkey("TURNLEFT");
		bindHotkey("TURNRIGHT");
		bindHotkey("STRAFELEFT");
		bindHotkey("STRAFERIGHT");
		bindHotkey("JUMP");
		bindHotkey("TARGETNEARESTENEMY");
		bindHotkey("TARGETNEARESTFRIEND");
	end

	-- check ingame settings
	-- only if we can find the bindings.txt file
	local function check_ingame_settings( _name, _ingame_key)
	-- no more needed, because we take the keys from the file if we found the file

		if( not bindings ) then		-- no bindings.txt file loaded
			return
		end;

		if( settings.hotkeys[_name].key ~= key["VK_"..bindings[_ingame_key].key1] and
		settings.hotkeys[_name].key ~= key["VK_"..bindings[_ingame_key].key2] ) then
			local msg = sprintf(language[125], _name);	-- settings.xml don't match your RoM ingame
			error(msg, 0);
		end
	end


	function checkHotkeys(_name, _ingame_key)
		if( not settings.hotkeys[_name] ) then
			error(language[126] .. _name, 0);	-- Global hotkey not set
		end

		-- check if settings.lua hotkeys match the RoM ingame settings
		-- check_ingame_settings( _name, _ingame_key);
	end


	for i,v in pairs(elements) do
		local name = v:getName();

		if( string.lower(name) == "hotkeys" ) then
			loadHotkeys(v);
		elseif( string.lower(name) == "options" ) then
			loadOptions(v);
		end
	end


-- TODO: don't work at the moment, becaus MACRO hotkey not available at this time
-- will first be available after reading profile file
	-- read language from client if not set in settings.xml
--	if( not settings.options.LANGUAGE ) then
--		local hf_language = RoMScript("GetLanguage();");	-- read clients language
--		if( hf_language == "DE" ) then
--			settings.options.LANGUAGE = "deutsch";
--		elseif(hf_language == "ENEU" ) then
--			settings.options.LANGUAGE = "english";
--		elseif(hf_language == "FR" ) then
--			settings.options.LANGUAGE = "french";
--		else
--			settings.options.LANGUAGE = "english";
--		end
--	end

	-- Load language files
	-- Load "english" first, to fill in any gaps in the users' set language.
	local function setLanguage(name)
		include("/language/" .. name .. ".lua");
	end

	local lang_base = {};
	setLanguage("english");
	for i,v in pairs(language) do lang_base[i] = v; end;
	setLanguage(settings.options.LANGUAGE);
	for i,v in pairs(lang_base) do
		if( language[i] == nil ) then
			language[i] = v;
		end
	end;
	lang_base = nil; -- Not needed anymore, destroy it.
	logMessage("Language: " .. settings.options.LANGUAGE);


	load_RoM_bindings_txt();	-- read bindings.txt from RoM user folder

	-- Check to make sure everything important is set
	--           bot hotkey name    RoM ingame key name
	checkHotkeys("MOVE_FORWARD",   "MOVEFORWARD");
	checkHotkeys("MOVE_BACKWARD",  "MOVEBACKWARD");
	checkHotkeys("ROTATE_LEFT",    "TURNLEFT");
	checkHotkeys("ROTATE_RIGHT",   "TURNRIGHT");
	checkHotkeys("STRAFF_LEFT",    "STRAFELEFT");
	checkHotkeys("STRAFF_RIGHT",   "STRAFERIGHT");
	checkHotkeys("JUMP",           "JUMP");
	checkHotkeys("TARGET",         "TARGETNEARESTENEMY");
	checkHotkeys("TARGET_FRIEND",  "TARGETNEARESTFRIEND");

end


function settings.loadProfile(_name)
	-- Delete old profile settings (if they even exist), restore defaults
	settings.profile = table.copy(settings_default.profile);

	local filename = getExecutionPath() .. "/profiles/" .. _name .. ".xml";
	local root = xml.open(filename);
	local elements = root:getElements();

	local loadOptions = function(node)
		local elements = node:getElements();

		for i,v in pairs(elements) do
			settings.profile.options[v:getAttribute("name")] = v:getAttribute("value");
		end
	end

	local loadHotkeys = function(node)
		local elements = node:getElements();

		for i,v in pairs(elements) do
			settings.profile.hotkeys[v:getAttribute("name")] = {};
			settings.profile.hotkeys[v:getAttribute("name")].name = v:getAttribute("name");
			settings.profile.hotkeys[v:getAttribute("name")].key = key[v:getAttribute("key")];
			settings.profile.hotkeys[v:getAttribute("name")].modifier = key[v:getAttribute("modifier")];

			if( key[v:getAttribute("key")] == nil ) then
				local err = sprintf(language[127], tostring(v:getAttribute("name")), _name );	-- Please set a valid key
				error(err, 0);
			end

			checkKeySettings(v:getAttribute("name"),
			  v:getAttribute("key"),
			  v:getAttribute("modifier") );

		end
	end

	local loadOnLoadEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onLoad = loadstring(luaCode);
			assert(settings.profile.events.onLoad, sprintf(language[151], "onLoad"));

			if( type(settings.profile.events.onLoad) ~= "function" ) then
				settings.profile.events.onLoad = nil;
			end;
		end
	end

	local loadOnDeathEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onDeath = loadstring(luaCode);

			assert(settings.profile.events.onDeath, sprintf(language[151], "onDeath"));

			if( type(settings.profile.events.onDeath) ~= "function" ) then
				settings.profile.events.onDeath = nil;
			end;
		end
	end

	local loadOnLeaveCombatEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onLeaveCombat = loadstring(luaCode);
			assert(settings.profile.events.onLeaveCombat, sprintf(language[151], "onLeaveCombat"));

			if( type(settings.profile.events.onLeaveCombat) ~= "function" ) then
				settings.profile.events.onLeaveCombat = nil;
			end;
		end
	end

	local loadOnLevelupEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onLevelup = loadstring(luaCode);
			assert(settings.profile.events.onLevelup, sprintf(language[151], "onLevelup"));

			if( type(settings.profile.events.onLevelup) ~= "function" ) then
				settings.profile.events.onLevelup = nil;
			end;
		end
	end

	local loadOnPreSkillCastEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onPreSkillCast = loadstring(luaCode);
			assert(settings.profile.events.onPreSkillCast, sprintf(language[151], "onPreSkillCast"));

			if( type(settings.profile.events.onPreSkillCast) ~= "function" ) then
				settings.profile.events.onPreSkillCast = nil;
			end;
		end
	end

	local loadOnHarvestEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onHarvest = loadstring(luaCode);
			assert(settings.profile.events.onHarvest, sprintf(language[151], "onHarvest"));

			if( type(settings.profile.events.onHarvest) ~= "function" ) then
				settings.profile.events.onHarvest = nil;
			end;
		end
	end

	local loadOnSkillCastEvent = function(node)
		local luaCode = node:getValue();
		if( luaCode == nil ) then return; end;

		if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
			settings.profile.events.onSkillCast= loadstring(luaCode);
			assert(settings.profile.events.onSkillCast, sprintf(language[151], "onSkillCast"));

			if( type(settings.profile.events.onSkillCast) ~= "function" ) then
				settings.profile.events.onSkillCast = nil;
			end;
		end
	end

	local skillSort = function(tab1, tab2)
		if( tab2.priority < tab1.priority ) then
			return true;
		end;

		return false;
	end

	local loadSkills = function(node)
		local elements = node:getElements();

		for i,v in pairs(elements) do
			local name, hotkey, modifier, level;
			name = v:getAttribute("name");
--			hotkey = key[v:getAttribute("hotkey")];
			modifier = key[v:getAttribute("modifier")];
			level = v:getAttribute("level");

			-- using the MACRO key as hotkey is also a valid key
			if( string.upper( tostring(v:getAttribute("hotkey")) ) == "MACRO" ) then
				hotkey = "MACRO";						-- set MACRO as hotkey
			else
				hotkey = key[v:getAttribute("hotkey")];	-- read the virtual key numer
			end

			checkKeySettings( v:getAttribute("name"),
			  v:getAttribute("hotkey"),
			  v:getAttribute("modifier") );

			-- Over-ride attributes
			local priority, maxhpper, maxmanaper, cooldown, inbattle, pullonly, maxuse, autouse, rebuffcut;
			priority = v:getAttribute("priority");
			maxhpper = tonumber((string.gsub(v:getAttribute("hpper") or "","!","-")));
			targetmaxhpper = tonumber((string.gsub(v:getAttribute("targethpper") or "","!","-")));
			targetmaxhp = tonumber((string.gsub(v:getAttribute("targethp") or "","!","-")));
			maxmanaper = tonumber((string.gsub(v:getAttribute("manaper") or "","!","-")));
			cooldown = tonumber(v:getAttribute("cooldown"));
			inbattle = v:getAttribute("inbattle");
			pullonly = v:getAttribute("pullonly");
			maxuse = tonumber(v:getAttribute("maxuse"));
			rebuffcut = tonumber(v:getAttribute("rebuffcut"));
			autouse = v:getAttribute("autouse");
		-- Ensure that autouse is a proper type.
			if( not (autouse == true or autouse == false) ) then
				autouse = true;
			end;

			-- check if 'wrong' options are set
			if( v:getAttribute("mana")      or
			    v:getAttribute("manainc")   or
			    v:getAttribute("rage")      or
			    v:getAttribute("energy")    or
			    v:getAttribute("concentration")      or
			    v:getAttribute("range")     or
			    v:getAttribute("minrange")  or
			    v:getAttribute("type")      or
			    v:getAttribute("target")    or
			    v:getAttribute("casttime") ) then
					local msg = sprintf(language[128], name, _name);	-- are no valid options for your skill
					error(msg, 0);
			end;

			if( name == nil) then
				local msg = sprintf(language[130], _name);	-- empty\' skill name
				error(msg, 0);
			end;

			if( inbattle ~= nil ) then
				if( inbattle == "true" or
					inbattle == true ) then
					inbattle = true;
				elseif( inbattle == "false"  or
					inbattle == false ) then
					inbattle = false;
				else
					local msg = sprintf(language[131], inbattle, name, _name);	-- wrong option inbattle

					error(msg, 0);
				end;
			end

			if( pullonly ~= nil ) then
				if( pullonly == "true" or
					pullonly == true ) then
					pullonly = true;
				else
					local msg = sprintf(language[132], pullonly, name, _name);	-- wrong option pullonly

					error(msg, 0);
				end;
			end

			if( level == nil or level < 1 ) then
				level = 1;
			end

			local baseskill = database.skills[name];
			if( not baseskill ) then
				local err = sprintf("ERROR: \'%s\' is not defined in the database!", name);
				error(err, 0);
			end

			local tmp = CSkill(database.skills[name]);
			tmp.hotkey = hotkey;
			tmp.modifier = modifier;
			tmp.Level = level;

			if( toggleable ) then tmp.Toggleable = toggleable; end;
			if( priority ) then tmp.priority = priority; end
			if( targetmaxhpper ) then tmp.TargetMaxHpPer = targetmaxhpper; end;
			if( targetmaxhp ) then tmp.TargetMaxHp = targetmaxhp; end;
			if( maxhpper ) then tmp.MaxHpPer = maxhpper; end;
			if( maxmanaper ) then tmp.MaxManaPer = maxmanaper; end;
			if( cooldown ) then tmp.Cooldown = cooldown; end;
			if( inbattle ~= nil ) then tmp.InBattle = inbattle; end;
			if( pullonly == true ) then tmp.pullonly = pullonly; end;
			if( maxuse ) then tmp.maxuse = maxuse; end;
			if( rebuffcut ) then tmp.rebuffcut = rebuffcut; end;
			if( autouse == false ) then tmp.AutoUse = false; end;

			table.insert(settings.profile.skills, tmp);
		end

		table.sort(settings.profile.skills, skillSort);
	end

	local loadFriends = function(node)
		local elements = node:getElements();

		for i,v in pairs(elements) do

			local name = v:getAttribute("name");

			if( name ) then name = trim(name); end;

			if( name ) then

				-- fix, because getAttribute seems not to recognize the escape characters
				-- for special ASCII characters
				name = string.gsub (name, "\\132", string.char(132));	-- ä
				name = string.gsub (name, "\\142", string.char(142));	-- Ä
				name = string.gsub (name, "\\148", string.char(148));	-- ö
				name = string.gsub (name, "\\153", string.char(153));	-- Ö
				name = string.gsub (name, "\\129", string.char(129));	-- ü
				name = string.gsub (name, "\\154", string.char(154));	-- Ü
				name = string.gsub (name, "\\225", string.char(225));	-- ß

				table.insert(settings.profile.friends, name);
			end
		end
	end

	local loadMobs = function(node)
		local elements = node:getElements();

		for i,v in pairs(elements) do

			local name = v:getAttribute("name");

			if( name ) then name = trim(name); end;

			if( name ) then

				-- fix, because getAttribute seems not to recognize the escape characters
				-- for special ASCII characters
				name = string.gsub (name, "\\132", string.char(132));	-- ä
				name = string.gsub (name, "\\142", string.char(142));	-- Ä
				name = string.gsub (name, "\\148", string.char(148));	-- ö
				name = string.gsub (name, "\\153", string.char(153));	-- Ö
				name = string.gsub (name, "\\129", string.char(129));	-- ü
				name = string.gsub (name, "\\154", string.char(154));	-- Ü
				name = string.gsub (name, "\\225", string.char(225));	-- ß

				table.insert(settings.profile.mobs, name);
			end
		end
	end

	local hf_temp = _name;	-- remember profile name shortly

	for i,v in pairs(elements) do
		local name = v:getName();

		if( string.lower(name) == "options" ) then
			loadOptions(v);
		elseif( string.lower(name) == "hotkeys" ) then
			loadHotkeys(v);
		elseif( string.lower(name) == "skills" ) then
			loadSkills(v);
		elseif( string.lower(name) == "friends" ) then
			loadFriends(v);
		elseif( string.lower(name) == "mobs" ) then
			loadMobs(v);
		elseif( string.lower(name) == "onload" ) then
			loadOnLoadEvent(v);
		elseif( string.lower(name) == "ondeath" ) then
			loadOnDeathEvent(v);
		elseif( string.lower(name) == "onleavecombat" ) then
			loadOnLeaveCombatEvent(v);
		elseif( string.lower(name) == "onlevelup" ) then
			loadOnLevelupEvent(v);
		elseif( string.lower(name) == "onskillcast" ) then
			loadOnSkillCastEvent(v);
		elseif( string.lower(name) == "onharvest" ) then
			loadOnHarvestEvent(v);
		elseif( string.lower(name) == "onpreskillcast" ) then
			loadOnPreSkillCastEvent(v);
		elseif( string.lower(name) == "skills_warrior"  and
		        player.Class1 == CLASS_WARRIOR ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_scout"  and
		        player.Class1 == CLASS_SCOUT ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_rogue"  and
		        player.Class1 == CLASS_ROGUE ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_mage"  and
		        player.Class1 == CLASS_MAGE ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_priest"  and
		        player.Class1 == CLASS_PRIEST ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_knight"  and
		        player.Class1 == CLASS_KNIGHT ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_warden"  and
		        player.Class1 == CLASS_WARDEN ) then
			loadSkills(v);
		elseif( string.lower(name) == "skills_druid"  and
		        player.Class1 == CLASS_DRUID ) then
			loadSkills(v);
		else		-- warning for other stuff and misspellings
			if ( string.lower(name) ~= "skills_warrior"     and
			     string.lower(name) ~= "skills_scout"       and
		 	     string.lower(name) ~= "skills_rogue"       and
	 		     string.lower(name) ~= "skills_mage"        and
			     string.lower(name) ~= "skills_priest"      and
			     string.lower(name) ~= "skills_knight"      and
			     string.lower(name) ~= "skills_warden"  and
			     string.lower(name) ~= "skills_druid" )     then
				cprintf(cli.yellow, tostring(language[60]), string.lower(tostring(name)),
					tostring(hf_temp));
			end;
		end
	end


	-- checks for MACRO hotkey
	-- print error if new macro option isn't defined
	if( not settings.profile.hotkeys.MACRO ) then
		cprintf(cli.yellow, language[900]);
		cprintf(cli.yellow, language[901]);
		cprintf(cli.yellow, language[902]);
		cprintf(cli.yellow, language[903]);
		cprintf(cli.yellow, language[904], "VK_0"); -- TODO: Change VK_0 to the actual hotkey we should use
		local msg = sprintf(language[905], _name);
		error(msg, 0);
	end

	-- Setup the macros ans action key.
	setupMacros()

	-- check if new macro option is working / ingame macro defined and assigned
	-- check it with a function with defined return values
	settings.options.DEBUGGING_MACRO = true;
	local hf_return = RoMScript("1234;ChatFrame1:AddMessage(\"MACRO test: send value 1234 to macro place 2\");");
	if( hf_return ~= 1234 ) then	-- return values not found
--		RoMScript("ChatFrame1:AddMessage(\"MACRO test: test failed !!! No return values found!\");");	-- overwrite return values
		cprintf(cli.yellow, language[906] );	-- Define ingame an empty macro

		if ( settings.profile.hotkeys.MACRO.key) then
			hf_temp = getKeyName(settings.profile.hotkeys.MACRO.key);
		else
			local hf_temp ="<UNKNOWN>";	-- if ignore, key must not be set, so give value
		end

		local msg = sprintf(language[904], hf_temp );

		error(msg, 0);
	else								-- return values found, clear it and send message
		cprintf(cli.green, "MACRO Test: ok\n" );
		RoMScript("xxxx; ChatFrame1:AddMessage(\"MACRO test: successful\");");	-- overwrite values
	end
	settings.options.DEBUGGING_MACRO = false;


	-- MACRO is working, we can automaticly reset the langugae
	-- remember game client language
	local hf_langu = RoMScript("GetLanguage();");
	if( not hf_langu ) then
		local msg = sprintf(language[62]);	-- Error while reading the language settings
--		error(msg, 0);
		cprintf(cli.yellow, msg);
		hf_langu = "ENEU";
	end
	bot.ClientLanguage = hf_langu;	-- remember clients language

	-- reset bot language to clients language
	if( settings.options.USE_CLIENT_LANGUAGE ) then
		local hf_language;
		if( bot.ClientLanguage == "DE" ) then
			hf_language = "deutsch";
		elseif(bot.ClientLanguage  == "FR" ) then
			hf_language = "french";
		elseif(bot.ClientLanguage  == "RU" ) then
			hf_language = "russian";
		elseif(bot.ClientLanguage == "PL" ) then
			hf_language = "polish";
		elseif(bot.ClientLanguage == "ES" ) then
			hf_language = "spanish";
		else
			hf_language = "english";
		end

		if( settings.options.LANGUAGE ~= hf_language ) then		-- load new language?

			local function setLanguage(_name)
				include("/language/" .. _name .. ".lua");
			end

			local lang_base = {};

			for i,v in pairs(language) do lang_base[i] = v; end;	-- remember current language value to fill gaps with that

			setLanguage(hf_language);
			for i,v in pairs(lang_base) do
				if( language[i] == nil ) then
					language[i] = v;
				end
			end;
			lang_base = nil; -- Not needed anymore, destroy it.
			logMessage("Load Language according to client language: " .. hf_language);

		end

	end


	-- now we can do all other setting checks


	-- Check if the player has any ranged damage skills
	local rangedSkills = false;
	for i,v in pairs(settings.profile.skills) do
		if( v.Range > 100  and
			( v.Type == STYPE_DAMAGE or
			  v.Type == STYPE_DOT ) ) then
			rangedSkills = true;
			printf(language[176], v.Name);		-- Ranged skill found
			break;
		end
	end

	if( rangedSkills == false and settings.profile.options.COMBAT_RANGED_PULL ) then
		cprintf(cli.yellow, language[200]);
		settings.profile.options.COMBAT_RANGED_PULL = false;
	end


--	function checkProfileHotkeys(name)
--		if( not settings.profile.hotkeys[name] ) then
--			error("ERROR: Hotkey not set for this profile: " ..name, 0);
--		end
--	end


	-- default combat type if not in profile defined
	if( settings.profile.options.COMBAT_TYPE ~= "ranged" and
	    settings.profile.options.COMBAT_TYPE ~= "melee" ) then
		if( player.Class1 == CLASS_WARRIOR or
		    player.Class1 == CLASS_ROGUE   or
		    player.Class1 == CLASS_WARDEN  or
		    player.Class1 == CLASS_KNIGHT  ) then
			settings.profile.options.COMBAT_TYPE  = "melee";
		elseif(
		    player.Class1 == CLASS_PRIEST  or
		    player.Class1 == CLASS_SCOUT   or
		    player.Class1 == CLASS_DRUID   or
		    player.Class1 == CLASS_MAGE    ) then
			settings.profile.options.COMBAT_TYPE  = "ranged";
		else
			error("undefined player.Class1 in settings.lua", 0);
		end;
	end


	-- check if range attack range and combat distance fit together
	local best_range = 0;
	for i,v in pairs(settings.profile.skills) do
		if( v.Range > best_range and
			( v.Type == STYPE_DAMAGE or
			  v.Type == STYPE_DOT ) ) then
			best_range = v.Range;
		end
	end

	-- check is combat distance is greater then maximum ranged attack
	if( best_range < settings.profile.options.COMBAT_DISTANCE  and
		(settings.profile.options.COMBAT_TYPE == "ranged" or
		settings.profile.options.COMBAT_RANGED_PULL == true) ) then
		local msg = sprintf(language[179], settings.profile.options.COMBAT_DISTANCE);	-- Maximum range of range attack skills is lesser
		error(msg, 0);
	end


	-- warning if not all inventory slots are updated
	if( settings.profile.options.INV_AUTOSELL_TOSLOT > settings.profile.options.INV_MAX_SLOTS ) then
		cprintf(cli.yellow, language[1003], settings.profile.options.INV_MAX_SLOTS, settings.profile.options.INV_AUTOSELL_TOSLOT);
	end


	-- check if igf addon is active
	if ( RoMScript("IGF_INSTALLED") == true ) then
		bot.IgfAddon = true;
	else
		bot.IgfAddon = false;
	end

	-- error if igf (ingamefunctions) addon isn't installed and options are set
	if( bot.IgfAddon == false	and
		( settings.profile.options.INV_AUTOSELL_NOSELL_DURA > 0	or
		  settings.profile.options.INV_AUTOSELL_STATS_NOSELL ~= nil ) ) then
		error(language[1004], 0)	-- Ingamefunctions addon (igf) is not installed
	end

	-- check if automatic targeting is active
	if( settings.profile.options.AUTO_TARGET == false ) then
		cprintf(cli.yellow, "Caution: Automatic targeting is deactivated with option AUTO_TARGET=\"false\"\n");
	end


end
Attachments
settings.lua
(38.66 KiB) Downloaded 127 times

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#12 Post by jver422 » Tue Feb 01, 2011 11:13 am

here's my profile aswell

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
	<options>
		<!-- Try the bot with a new char mage                   -->
		<!-- At the pioneer village. Use demo.xml waypoint file -->
		<option name="HP_LOW"			value="85" />
		<option name="MP_LOW_POTION"	value="50" />
		<option name="HP_LOW_POTION"	value="40" />
		<option name="USE_HP_POTION"	value="best" />	<!-- potion select strategy: best|minstack -->
		<option name="USE_MANA_POTION"	value="best" />	<!-- potion select strategy: best|minstack -->

		<!-- Rest if HP or Mana is below that level -->
		<option name="HP_REST" value="15" />
		<option name="MP_REST" value="15" />

		<!-- Shopping options, how many of what do you want to keep in your inventory -->
		<option name="HEALING_POTION" value="99" />
		<option name="MANA_POTION" value="99" />
		<option name="ARROW_QUIVER" value="2" />
		<option name="THROWN_BAG" value="2" />
		<option name="POISON" value="30" />

		<!-- either false or arrow or thrown -->
		<option name="RELOAD_AMMUNITION" value="false" />	<!-- false|arrow|thrown -->

		<!-- Combat options -->
		<option name="COMBAT_TYPE"        value="" />	<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
		<option name="COMBAT_DISTANCE"    value="200" />
		<option name="MAX_FIGHT_TIME"     value="15" />	<!-- Max time without damage before break -->
		<option name="DOT_PERCENT"        value="90" />
		<option name="ANTI_KS"            value="true" />
		<option name="MAX_TARGET_DIST"    value="225" />

		<!-- Attack monsters 3 levels above or 10 below your level -->
		<option name="TARGET_LEVELDIF_ABOVE" value="3" />
		<option name="TARGET_LEVELDIF_BELOW" value="10" />

		<!-- Waypoint and movement settings -->
		<option name="WAYPOINTS"		value="MillersRanchChickens" />  <!-- leave empty to show a list -->
		<option name="RETURNPATH"		value="" />
		<option name="PATH_TYPE"		value="waypoints" />	<!-- waypoints | wander -->
		<option name="WANDER_RADIUS"		value="500" />
		<option name="WAYPOINT_DEVIATION"	value="0" />
		<option name="QUICK_TURN" 		value="false" />

		<!-- Loot settings -->
		<option name="LOOT"               value="true" />
		<option name="LOOT_IN_COMBAT"     value="true" />
		<option name="LOOT_DISTANCE"      value="100" />
		<option name="LOOT_PAUSE_AFTER"   value="0" />		<!-- probability in % for a short rest -->

		<!-- Harvest options -->
		<option name="HARVEST_DISTANCE"		value="120" />
		<option name="HARVEST_WOOD"			value="true" /> <!-- Choose which types to harvest. -->
		<option name="HARVEST_HERB"			value="true" /> <!-- "true" = harvest, "false" = do not harvest -->
		<option name="HARVEST_ORE"			value="true" />

		<!-- Eggpet options -->
		<option name="EGGPET_ENABLE_CRAFT"	value="false" /><!-- If using same slot for assist and craft, onlt 1 can be enabled. -->
		<option name="EGGPET_CRAFT_SLOT"	value="1" />
		<option name="EGGPET_ENABLE_ASSIST"	value="false" />
		<option name="EGGPET_ASSIST_SLOT"	value="1" />
		<option name="EGGPET_CRAFT_RATIO"	value="1:4:4" /> <!-- mining:woodworking:herbalism ratio to produce. -->
		<option name="EGGPET_CRAFT_INDEXES"	value="" /> 	 <!-- override auto craft index for mining,woodworking,herbalism eg. "2,,"-->


		<!-- Log out and resurrect settings -->
		<option name="LOGOUT_TIME" 			value="0" />	<!-- in minutes, 0 = timer disabled -->
		<option name="LOGOUT_SHUTDOWN"		value="false" />
		<option name="LOGOUT_WHEN_STUCK"	value="true" />
		<option name="CLOSE_WHEN_STUCK"		value="true" />
		<option name="RES_AUTOMATIC_AFTER_DEATH" value="true" />
		<option name="MAX_DEATHS" value="10" /> <!-- Log out after this many deaths -->

		<!-- For more options and documentation see the RoM Bot Wiki:  -->
		<!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot  -->

	</options>

	<friends>
		<!-- names of friends we help fighting or enemys we don't want to attack -->
		<!-- for umlauts use \129 (ue),\132 (ae),\148 (oe) e.g. K\132fer         -->
		<friend name="MyOtherCharacter1" />
		<friend name="MyOtherCharacter2" />
		<friend name="Elite_Mob_Name1" />
		<friend name="Elite_Mob_Name2" />
	</friends>

	<mobs>
		<!-- names of mobs we want to attack 				-->
		<!-- if no names defined we will attack all mobs	-->
		<mob name="" />
		<mob name="" />
		<mob name="" />
	</mobs>

	<hotkeys>
    	<!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->
		<hotkey name="MACRO"        modifier="" key="VK_0" />
	</hotkeys>

	<!-- define your skills depending from your actual primary class -->
	<!-- see the example for a priest/mage                           -->
	<!-- delete skills you don't have or don't want to use.          -->
	<!-- For more skills to use see /database/skills.xml             -->
	<!-- demo skills for LvL 1 character for all classes             -->
	<skills_priest>
		<skill name="PRIEST_REGENERATE"    modifier="" hotkey="VK_7" priority="90" />
		
	</skills_priest>

	
	<skills_scout>
		<skill name="SCOUT_SHOT"        modifier="" hotkey="VK_4" priority="70" />
		<skill name="SCOUT_AUTOSHOT"    modifier="" hotkey="VK_1" priority="70" />
		<skill name="SCOUT_WIND_ARROWS" modifier="" hotkey="VK_2" priority="120" />
		<skill name="SCOUT_VAMPIRE_ARROWS" modifier="" hotkey="VK_3" priority="100" />
		<skill name="SCOUT_COMBO_SHOT"    modifier="" hotkey="VK_5" priority="70" />
		<skill name="SCOUT_BLOOD_ARROW"    modifier="" hotkey="VK_6" priority="70" />
	</skills_scout>

	
	<onLoad><![CDATA[
		-- Additional Lua code to execute after loading the profile
		-- and before the bot starts. e.g. You could overwrite profile settings here
		-- like: changeProfileOption("HP_REST", 60);
	]]></onLoad>

	<onDeath><![CDATA[
		-- Additional Lua code to execute on death
		-- pauseOnDeath(); -- Stop the script
		-- player:logout();	-- logout
	]]></onDeath>

	<onLeaveCombat><![CDATA[
		-- Additional Lua code to execute after killing an enemy
	]]></onLeaveCombat>

	<onLevelup><![CDATA[
		-- Additional Lua code to execute after having a levelup
		-- and levelup the skills for a new character (mage or priest recommended)
		-- e.g. sendMacro("SetSpellPoint(_tabnr, _skillnr);"); would levelup a skill
	]]></onLevelup>

	<onSkillCast><![CDATA[
		-- Additional Lua code to execute when casting a skill
		-- Note: arg1 contains the skill being used.
		-- i.e. arg1.Name will be the name of the skill being cast
		-- e.g.:
		--if( 15 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_SOUL_SOURCE");
		--elseif( 25 > player.HP/player.MaxHP*100 ) then
		--    player:cast("PRIEST_HOLY_AURA");
		--    player:cast("PRIEST_URGENT_HEAL");
		--    player:cast("PRIEST_URGENT_HEAL");
	]]></onSkillCast>

	<onHarvest><![CDATA[
		-- Additional Lua code to execute directly before the actual harvesting takes place.
		-- Note: arg1 contains the object to be harvested.
		-- i.e. arg1.Name will be the name of the node you are about to harvest
		-- If this snippet returns 'false', the node will *not* be harvested.
		-- All other return values result in the player attempting to harvest the node.
		-- Note that returning 'false' here breaks out of harvesting completely;
		-- You will not attempt to harvest other nearby nodes instead.
	]]></onHarvest>
</profile>
and the way-points i'm using

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>

<!--        Rock5's Millers Ranch Chickens run        -->
<!--           By Rock5         Version 2.0           -->
<!-- www.solarstrike.net/phpBB3/viewtopic.php?p=12139 -->

<onLoad>
	changeProfileOption("HARVEST_DISTANCE", 150)
	repeat questname=RoMScript("TEXT('Sys422386_name')"); yrest(500) until questname -- ie. "An Easy Lay?"
	repeat npcname=RoMScript("TEXT('Sys114930_name')"); yrest(500) until npcname -- ie. "Jenna Miller"

	repeat zoneid = RoMScript("GetZoneID()") until zoneid
	if zoneid ~= 304 then -- not at Miller's Ranch
		-- Try to find Sorrun and teleport in
		if player:target_NPC("Sorrun") then
			sendMacro("ChoiceOption(3)") yrest(1000)
			sendMacro("ChoiceOption(1)")
			waitForLoadingScreen()
		else
			error("You are too far from Miller's Ranch")
		end
	end

	function feedHenEvalFunc(address)
		hen = CObject(address)

		-- Don't target hens in coop
		if hen.Z > 3240 then return false end -- Hen in coop

		-- Don't target moving hens
		oldX = hen.X; oldZ = hen.Z
		yrest(100)
		hen:update()
		if distance(hen.X,hen.Z,oldX,oldZ) > 2 then return false end

		return true
	end

	function coopHenEvalFunc(address)
		-- Only target coop Hens
		if 3240 > CObject(address).Z then return false end

		return true
	end
</onLoad>
	<!-- #  1 --><waypoint x="4033" z="3450">	</waypoint>
	<!-- #  1 --><waypoint x="4029" z="3327">	</waypoint>
	<!-- #  1 --><waypoint x="4016" z="3172">	</waypoint>
	<!-- #  1 --><waypoint x="3948" z="3107" tag="Main">
		repeat queststate = getQuestStatus(questname); yrest(500) until queststate
		if queststate ~= "incomplete" then
			player:target_NPC(npcname);
			if queststate == "complete" then
				-- Complete quest
				sendMacro("CompleteQuest()"); yrest(2000);
			end
			-- Accept quest
			player:target_NPC(npcname);
			sendMacro("AcceptQuest()"); yrest(2000);
			__WPL:setWaypointIndex(__WPL:findWaypointTag("Main"))
		else
			while inventory:itemTotalCount(204789) > 0 and -- While you have feed
				player:target_Object(112955,nil,nil,true,feedHenEvalFunc) do -- Feed Hens
			end
			-- Out of feed or hens
			if 1 > inventory:itemTotalCount(204789) then -- Get more feed
				__WPL:setWaypointIndex(__WPL:findWaypointTag("Get Feed"));
			else
				__WPL:setWaypointIndex(__WPL:findWaypointTag("Get Eggs"))
			end
		end
	</waypoint>
	<!-- #  2 --><waypoint x="3940" z="3055" tag="Get Feed">	</waypoint>
	<!-- #  4 --><waypoint x="3937" z="2978">
	player:target_Object(112956,nil,true)
	</waypoint>
	<!-- #  5 --><waypoint x="3935" z="3051">__WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));	</waypoint>
	<!-- #  6 --><waypoint x="3928" z="3185" tag="Get Eggs">	</waypoint>
	<!-- #  8 --><waypoint x="3929" z="3261">
		--changeProfileOption("HARVEST_DISTANCE", 40)
		while player:target_Object(112955,nil,nil,true,coopHenEvalFunc) do -- Check for hens
			yrest(500)
			player:target_Object(112958,nil,true) -- Get Fresh Eggs
			player:target_Object(114931,nil,true) -- Get Golden Eggs
		end
		-- changeProfileOption("HARVEST_DISTANCE", 150)
	</waypoint>
	<!-- #  9 --><waypoint x="3926" z="3198">__WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));	</waypoint>
</waypoints>

JackBlonder
Posts: 99
Joined: Sat Dec 18, 2010 6:55 am

Re: i just got the bot and need help getting it running

#13 Post by JackBlonder » Tue Feb 01, 2011 11:16 am

[Edit] Posted during your second post
Do you have set up your ingame dummy macro?

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

Re: i just got the bot and need help getting it running

#14 Post by Administrator » Tue Feb 01, 2011 11:42 am

And where's your settings.xml?

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#15 Post by jver422 » Tue Feb 01, 2011 12:07 pm

JackBlonder wrote:[Edit] Posted during your second post
Do you have set up your ingame dummy macro?
yes i set a blank macro in the first macro slot and in the 0 hotkey

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#16 Post by jver422 » Tue Feb 01, 2011 12:08 pm

Administrator wrote:And where's your settings.xml?

Code: Select all

<settings>
	<hotkeys>
		<!-- Cannot use modifiers -->
		<hotkey description="MOVE_FORWARD" key="VK_W" modifier="" />
		<hotkey description="MOVE_BACKWARD" key="VK_S" modifier="" />
		<hotkey description="ROTATE_LEFT" key="VK_Q" modifier="" />
		<hotkey description="ROTATE_RIGHT" key="VK_E" modifier="" />
		<hotkey description="STRAFF_LEFT" key="VK_A" modifier="" />
		<hotkey description="STRAFF_RIGHT" key="VK_D" modifier="" />
		<hotkey description="JUMP" key="VK_SPACE" modifier="" />

		<hotkey description="TARGET" key="VK_TAB" modifier="" />
		<hotkey description="TARGET_FRIEND" key="VK_J" modifier="" />
	</hotkeys>

	<options>
		<option name="ENABLE_FIGHT_SLOW_TURN" value="false" />
		<option name="MELEE_DISTANCE" value="50" />
		<option name="LANGUAGE" value="english" />	<!-- english|deutsch|french|russian -->
		<option name="USE_CLIENT_LANGUAGE" value="true" />
		<option name="DEBUGGING" value="false" />

		<!--
			Leave ROMDATA_PATH blank to use automatic settings.
			If it cannot find your bindings.txt automatically,
			place the FULL PATH to the "Runes of Magic"
			directory here.
		-->
		<option name="ROMDATA_PATH" value="" />
	</options>
</settings>
Attachments
settings.xml
(1.18 KiB) Downloaded 109 times

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

Re: i just got the bot and need help getting it running

#17 Post by Administrator » Tue Feb 01, 2011 4:22 pm

Try using the default profile and see if that works. Just type "rom/bot.lua profile:default" to do that.

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#18 Post by jver422 » Tue Feb 01, 2011 4:42 pm

Administrator wrote:Try using the default profile and see if that works. Just type "rom/bot.lua profile:default" to do that.
still having the problem =/ does your bot work? maybe you can just attach the settings.lua that you have and maybe it will work for me

everything has a gree check so idk what the problem is

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

Re: i just got the bot and need help getting it running

#19 Post by Administrator » Tue Feb 01, 2011 4:54 pm

You shouldn't be modifying settings.lua. If you did, there is your problem right there.

Attach log.txt from the MicroMacro root folder.

jver422
Posts: 22
Joined: Tue Jan 25, 2011 5:05 pm

Re: i just got the bot and need help getting it running

#20 Post by jver422 » Tue Feb 01, 2011 5:05 pm

i never modified anything other then my profile and even then that was after making a copy of the default =/ i read on one forum that when setting up i should run svn update but then if there are any red or yellow left then i should delete that file and run svn update again, that might have been it, maybe the settings were marked witrh red so i deleted them and ran svn update and got the wrong one back or something any way here is what you asked for
Attachments
log.txt
(2.25 KiB) Downloaded 96 times

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests