Code: Select all
<profile>
<options>
<option name="HP_LOW" value="85" />
<option name="MP_LOW_POTION" value="50" />
<option name="HP_LOW_POTION" value="40" />
<option name="COMBAT_TYPE" value="melee" />
<option name="COMBAT_DISTANCE" value="10" />
<option name="ANTI_KS" value="true" />
<option name="WAYPOINTS" value="bandits.xml" />
<option name="RETURNPATH" value="bandits_return.xml" />
<option name="PATH_TYPE" value="wander" />
<option name="WANDER_RADIUS" value="200" />
<option name="WAYPOINT_DEVIATION" value="50" />
<option name="LOOT" value="true" />
<option name="LOOT_TIME" value="2000" />
<option name="LOOT_DISTANCE" value="100" />
<option name="ENERGY_STORAGE_1" value="energy" />
<option name="ENERGY_STORAGE_2" value="none" />
<option name="POTION_COOLDOWN" value="15" />
<option name="MAX_FIGHT_TIME" value="5" />
<option name="DOT_PERCENT" value="5" />
</options>
<friends>
<friend name="MyOtherCharacter1" />
<friend name="MyOtherCharacter2" />
</friends>s
<hotkeys>
<hotkey name="HP_POTION" key="VK_8" modifier="" />
<hotkey name="MP_POTION" key="VK_EQUAL" modifier="" />
<hotkey name="ATTACK" key="VK_9" modifier="" />
<hotkey name="RES_MACRO" key="VK_7" modifier="" />
</hotkeys>
<skills>
<skill name="ROGUE_SHADOWSTAB" hotkey="VK_2" modifier="" />
<skill name="ROGUE_LOW_BLOW" hotkey="VK_1" modifier="" />
<skill name="ROGUE_WOUND_ATTACK" hotkey="VK_3" modifier="" />
</skills>
<onDeath>
-- Additional Lua code to execute on death
pauseOnDeath(); -- Stop the script
</onDeath>
<onLeaveCombat>
-- Additional Lua code to execute after killing an enemy
</onLeaveCombat>
<onSkillCast>
-- 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.
</onSkillCast>
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},
},
options = {
MELEE_DISTANCE = 45,
LANGUAGE = "english",
},
profile = {
options = {
HP_LOW = 50,
MP_LOW_POTION = 50,
HP_LOW_POTION = 40,
COMBAT_TYPE = "melee",
COMBAT_DISTANCE = 200,
ANTI_KS = true,
WAYPOINTS = "myWaypoints.xml",
RETURNPATH = nil,
PATH_TYPE = "wander",
WANDER_RADIUS = 700,
WAYPOINT_DEVIATION = 0,
LOOT = false,
LOOT_TIME = 2000,
LOOT_DISTANCE = nil,
ENERGY_STORAGE_1 = "energy",
ENERGY_STORAGE_2 = "none",
POTION_COOLDOWN = 15,
MAX_FIGHT_TIME = 30,
DOT_PERCENT = 5,
}, hotkeys = {}, skills = {}, friends = {},
events = {
onDeath = function () pauseOnDeath(); end,
onLeaveCombat = nil,
onSkillCast = nil,
}
},
};
settings = settings_default;
function settings.load()
local filename = getExecutionPath() .. "/settings.xml";
local root = xml.open(filename);
local elements = root:getElements();
-- 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("settings.xml error: %s does not name a valid hotkey!", v:getAttribute("key"));
error(err, 0);
end
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
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
function checkHotkeys(name)
if( not settings.hotkeys[name] ) then
error("ERROR: Global hotkey not set: " .. name, 0);
end
end
-- Check to make sure everything important is set
checkHotkeys("MOVE_FORWARD");
checkHotkeys("MOVE_BACKWARD");
checkHotkeys("ROTATE_LEFT");
checkHotkeys("ROTATE_RIGHT");
checkHotkeys("STRAFF_LEFT");
checkHotkeys("STRAFF_RIGHT");
checkHotkeys("JUMP");
--checkHotkeys("CLEAR_TARGET");
checkHotkeys("TARGET");
end
function settings.loadProfile(name)
-- Delete old profile settings (if they even exist), restore defaults
settings.profile = 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")].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("profile error: %s does not name a valid hotkey!", v:getAttribute("key"));
error(err, 0);
end
end
end
local loadOnDeathEvent = function(node)
local luaCode = tostring(node:getValue());
if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
settings.profile.events.onDeath = loadstring(luaCode);
if( type(settings.profile.events.onDeath) ~= "function" ) then
settings.profile.events.onDeath = nil;
end;
end
end
local loadOnLeaveCombatEvent = function(node)
local luaCode = tostring(node:getValue());
if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
settings.profile.events.onLeaveCombat = loadstring(luaCode);
if( type(settings.profile.events.onLeaveCombat) ~= "function" ) then
settings.profile.events.onLeaveCombat = nil;
end;
end
end
local loadOnSkillCastEvent = function(node)
local luaCode = tostring(node:getValue());
if( string.len(luaCode) > 0 and string.find(luaCode, "%w") ) then
settings.profile.events.onSkillCast = loadstring(luaCode);
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, priority;
name = v:getAttribute("name");
hotkey = key[v:getAttribute("hotkey")];
modifier = key[v:getAttribute("modifier")];
level = v:getAttribute("level");
priority = v:getAttribute("priority");
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( priority ) then tmp.priority = priority; 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");
table.insert(settings.profile.friends, name);
end
end
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) == "ondeath" ) then
loadOnDeathEvent(v);
elseif( string.lower(name) == "onleavecombat" ) then
loadOnLeaveCombatEvent(v);
elseif( string.lower(name) == "onskillcast" ) then
loadOnSkillCastEvent(v);
end
end
function checkProfileHotkeys(name)
if( not settings.profile.hotkeys[name] ) then
error("ERROR: Hotkey not set for this profile: " ..name, 0);
end
end
-- Check to make sure everything important is set
checkProfileHotkeys("ATTACK");
if( settings.profile.options.COMBAT_TYPE ~= "ranged" and settings.profile.options.COMBAT_TYPE ~= "melee" ) then
error("COMBAT_TYPE must be \"ranged\" or \"melee\"", 0);
end
-- Make sure they didn't use the same type of energy storage for both (hence breaking it)
if( settings.profile.options.ENERGY_STORAGE_1 == settings.profile.options.ENERGY_STORAGE_2 ) then
error("Do not use the same energy storage for primary and secondary!\nEdit your profile to fix this.", 0);
end;
end
And my guy ALWAYS end up swimming into the wall of varanas in the middle of the moat. And most of the time when my character agroes more than 1 enemy he sometimes doesnt target the second guy after killing the first and just keeps targeting new enemies without killling the other guy attacking him.
And one last thing when i try to make a waypoint i cant save it it just doesnt let me type anything in or anything after i press num3