Page 1 of 1
Swapping Classes
Posted: Sun Jan 02, 2011 9:31 pm
by jduartedj
This code was provided to me by raff. I give him full credit even if i changed the code slightly.
USAGE: swapClass([npc, choice]) where npc is the name of the npc to target and choice it the number of the choice to choose in the talk dialog. if no npc is given it assumes it is already targeted and if no choice is given then it defaults to 3 which is the house maids' choice nr.
Latest file: V2.1 - included redoing the bot macros
V2.0 - added a macro to the game macros that does the same but ingame
V1.01 - fixed a syntax error (my bad!)
for version 2.0 ingame macro all you need is to select a housemaid and run the macro.
Re: Swapping Classes
Posted: Sun Jan 02, 2011 10:12 pm
by rock5
I see a couple of problems.
The big one is that different classes need different skill sets loaded. I actually have that on my todo list. But you might not intend to fight with it, so that's ok.
Second, not everyone swaps their equipment when they change class. I guess it could just be commented out. But then why swap your equipment if you can't fight with that class?
I guess it would mostly be useful for switching class to turn in quests and leveling up your secondary class.
In that situation I usually just use the createpath options to target_NPC and choose the change class option, but then I have streamline installed so this might still be useful for those that don't.
Re: Swapping Classes
Posted: Mon Jan 03, 2011 8:16 am
by jduartedj
Well I've heard of that problem before. But until there is a way to fast and safe reloading your profile This will be only meant for small stuff. But yeah delivering quests would on top of the list. Also Loading a new profile mid-bot would be useful to me. would it be to anyone?
Re: Swapping Classes
Posted: Thu Jan 06, 2011 9:49 pm
by lisa
rock5 wrote:I see a couple of problems.
The big one is that different classes need different skill sets loaded. I actually have that on my todo list. But you might not intend to fight with it, so that's ok.
I'm in the middle of setting up a M/P set of WP to do 1-10/10. I'm setting the profile to have all skills I need for both classes in the <skills_mage> set. That way when I change class I can use the priest skills to fight with. I'm using the ""setActionKeyToId"" to set the skills so both classes have skills required on the appropriate buttons that is set in the <skills_mage>.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 2:29 am
by rock5
lisa wrote:rock5 wrote:I see a couple of problems.
The big one is that different classes need different skill sets loaded. I actually have that on my todo list. But you might not intend to fight with it, so that's ok.
I'm in the middle of setting up a M/P set of WP to do 1-10/10. I'm setting the profile to have all skills I need for both classes in the <skills_mage> set. That way when I change class I can use the priest skills to fight with. I'm using the ""setActionKeyToId"" to set the skills so both classes have skills required on the appropriate buttons that is set in the <skills_mage>.
A better idea might be to put all your skills between <skills> tags instead. That way if you have to restart your bot when your character is a priest (like when your client crashes or your internet connection is interrupted) the skills will still be available.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 3:44 am
by lisa
I copy pasted the skills to the priest section. =)
Edit:
Only real issue I have is the bot tries to use the skills that it can't possibly use. i.e. Flame when on priest. Doesn't cause issues but slows bot down when it sits for 1-2 secs waiting for skill to cast before continueing with other skills.
Any chance of adding in the skill.lua that it detects main class and if it's a primary skill from secondary class then not to try to use it.
So for P/M it checks main class which is priest and so doesn't try to cast flame which is a mage only skill.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 6:03 am
by rock5
How about
Code: Select all
for k,v in pairs(settings.profile.skills) do
-- List of skills you want to use only as priest
if v.Name == "FIRST_TO_DISABLE" or
v.Name == "SECOND_TO_DISABLE" or
v.Name == "THIRD_TO_DISABLE" then
if player.Class == CLASS_PRIEST then
settings.profile.skills[k].AutoUse = true
else
settings.profile.skills[k].AutoUse = false
end
end
-- List of skills you want to use only as mage
if v.Name == "FIRST_TO_DISABLE" or
v.Name == "SECOND_TO_DISABLE" or
v.Name == "THIRD_TO_DISABLE" then
if player.Class == CLASS_MAGE then
settings.profile.skills[k].AutoUse = true
else
settings.profile.skills[k].AutoUse = false
end
end
end
Wow, that turned out more complex than I thought it would.
Maybe use it in the onload section of the profile or in the waypoint file after the bot changes class. It disables the disables the non-primary class skills.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 11:32 am
by lisa
Works great, thanks =)
For some reason I can't get the following to work.
I'm probably missing something simple =(
When you change class for the first time the new class doesn't have the macro setup for 0 on action bar and since bot is already running it doesn't set it up for you.
Hope you don't think I am hijacking your thread jd, it's all to do with swapping classes and issues that arise from doing so.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 6:19 pm
by rock5
lisa wrote:Works great, thanks =)
For some reason I can't get the following to work.
I'm probably missing something simple =(
When you change class for the first time the new class doesn't have the macro setup for 0 on action bar and since bot is already running it doesn't set it up for you.
Hope you don't think I am hijacking your thread jd, it's all to do with swapping classes and issues that arise from doing so.
Each class has it's own action bar so when you change class the action bar changes too. So you would have to re-set it when you change class if it doesn't already exist.
Plus the action keys go from 1 to 80, I believe, so I don't think that command will work.
Edit: Wait, I just realized what you wanted. Try running
after changing class. That should set up the action key for you.
Re: Swapping Classes
Posted: Fri Jan 07, 2011 7:12 pm
by jduartedj
Lisa keep up the good work!
Re: Swapping Classes
Posted: Fri Jan 07, 2011 9:38 pm
by lisa
rock5 wrote:How about
Code: Select all
for k,v in pairs(settings.profile.skills) do
-- List of skills you want to use only as priest
if v.Name == "PRIEST_RISING_TIDE" then
if player.Class1 == CLASS_PRIEST then
settings.profile.skills[k].AutoUse = true
else
settings.profile.skills[k].AutoUse = false
end
end
-- List of skills you want to use only as mage
if v.Name == "MAGE_ELEMENTAL_CATALYST" or
v.Name == "MAGE_FLAME" then
if player.Class1 == CLASS_MAGE then
settings.profile.skills[k].AutoUse = true
else
settings.profile.skills[k].AutoUse = false
end
end
end
Wow, that turned out more complex than I thought it would.
Maybe use it in the onload section of the profile or in the waypoint file after the bot changes class. It disables the disables the non-primary class skills.
Not a direct quote, adjusted player.Class to player.Class1 and added skills I wanted to use/not use =)
Re: Swapping Classes
Posted: Fri Jan 07, 2011 11:23 pm
by rock5
lisa wrote: adjusted player.Class to player.Class1
I'm happy that was the only typo considering I wrote that on the spot.

Re: Swapping Classes
Posted: Fri Jan 07, 2011 11:40 pm
by lisa
Works good for now =)
My next project is to make up a set of functions to call dependant on class.
i.e.
have it call to the settings elsewhere to detect class and then lvl up designated skills.
Code: Select all
if player.Class1 == CLASS_MAGE then
_PRIMARY == MAGE_FLAME
_SECONDAY == MAGE_FIREBALL
end
if player.Class1 == CLASS_PRIEST then
_PRIMARY == PRIEST_RISING_TIDE
_SECONDAY == PRIEST_URGENT_HEAL
end
I am purely guessing at the coding, not something I have really learnt yet lol
Something similar for the adding skills to action bar.
If I can get that going then my 1-10/10 won't be specific for mage as it is now.
Edit:
Had another thought, I could create different profile files i.e. SR.xml which would be a scout/rogue and have in profile to set some variables so that the right skills are lvled up when called for and also change the waypoints to set to rogue in class hall. This would probably be a better way of doing it.
Edit 2:
After some help from rock5 I have that skill coding working exactly how I want it to. Might have something to add to forum after weekend. It is looking like I should be able to make any class and also any second class do the 1-10/10. Need a few days to make sure it runs smoothly though.
It's funny it look me a couple hours to create the 1-10/10 but a few days to test it and clean up any bugs lol
Re: Swapping Classes
Posted: Sun Jan 16, 2011 9:12 pm
by jduartedj
Major update 2.0
Re: Swapping Classes
Posted: Sun Jan 16, 2011 11:13 pm
by lisa
You've got this
Code: Select all
sendMacro("ExchangeClass(EXCHANGECLASS_SUBCLASS, EXCHANGECLASS_MAINCLASS)");
sendMacro("SwapEquipmentItem();");
try this
Code: Select all
sendMacro("ExchangeClass(EXCHANGECLASS_SUBCLASS, EXCHANGECLASS_MAINCLASS)");
yrest(1000);
player:update();
yrest(1000);
setupMacros()
yrest(1000);
sendMacro("SwapEquipmentItem();");
It will make sure the new class has a bot macro setup.
Re: Swapping Classes
Posted: Sun Jan 16, 2011 11:26 pm
by jduartedj
Yeah I guess it's a good thing.
EDIT: update to V2.1 with
Code: Select all
sendMacro("ExchangeClass(EXCHANGECLASS_SUBCLASS, EXCHANGECLASS_MAINCLASS)");
sendMacro("SwapEquipmentItem();");
player:update();
setupMacros();
Re: Swapping Classes
Posted: Mon Jan 17, 2011 10:10 am
by lisa
You need the setup macro before the swap equipment as swap equipment uses the macro to send an ingame command.