Page 1 of 1
Need ideas on how to implement something
Posted: Mon Jan 10, 2011 8:15 pm
by lisa
Ok so what I've done is added 3 new attributes to the skills and then used them like this
Code: Select all
function checkskilllvl()
for k,v in pairs(settings.profile.skills) do
minsklvl = (player.Level + 1)
if v.minxx == player.Class1 and minsklvl > v.minlvl then
settings.profile.skills[k].AutoUse = true
else
settings.profile.skills[k].AutoUse = false
end
if v.minxx == player.Class2 and minsklvl > v.minlvl then
settings.profile.skills[k].AutoUse = true
end
if v.minxx == player.Class2 and v.primxx == 2 then
settings.profile.skills[k].AutoUse = false
end
end
end
The 3 attributes I added are primxx, minxx and minlvl. I set all the values in my profile skill section.
So calling this function onload and onlevelup makes the bot check the skills and dissable ones it can't use.
Doing this you can now have a high lvl skill in your profile and the bot won't try to keep using it before it can actually use the skill in game. Also if you don't have your second class activated then it won't try to use any of the second class skills named in profile either.
So yeah trouble is I am calling for attributes from the settings.lua and I want a way to do it without needing to change settings.lua.
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 8:45 pm
by rock5
I think your problem is you are trying to create an uber profile that will work with any class combination of any level. This is not normally useful to most people. Profiles are for characters and characters can have only 2 classes. Also all characters are unique so trying to create a generic profile is not a good idea.
On the surface having a minimum skill level would seem to be useful so you could add high level skills that will only be used when you reach that level, but then again as you level up you should be continuously readjusting your skill list, removing as well as adding skills and even changing the sequence.
At most I might use something like this to add a few skills, eg to my 1 to 10 scripts to include the skills you might get while leveling to 10.
Code: Select all
if player.Class1 >= x then
set AutoUse = true for the level x skills
end
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 9:02 pm
by lisa
You kind of lost me there unless you meant player.Level instead of player.Class1
Either way you would still need a set lvl for the skills to compare to otherwise it wouldn't know if it can use the skill or not, so still need skill minimum level value to be set somewhere.
I notice in the database/skills.xml you have started adding in aslevel values which appear to be the minimum level to use the skill. Any way to call for those values? Pretty sure I tried a few nights ago and failed.
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 9:23 pm
by rock5
Not if you just manually add it ie.
if player.Level > 1 then add plasma arrow end
But that wouldn't be practical if you want to include every skill in the skill database.

It would only be practical for a handful of skills.
Maybe you could create your own database of skill names and levels that you want to include. Then you could do something like what you want to do.
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 9:37 pm
by lisa
Creating a new database would be easy enough, little time consuming but I can handle that without to much hassle.
Trouble I was having when trying that before was getting it to use those values with the specific skills.
So would need to call for the skill from profile and then look for the attribute from a different database while still only concidering that skill.
My coding isn't quite that good yet but I am learning as I go lol
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 10:07 pm
by rock5
lisa wrote:Creating a new database would be easy enough, little time consuming but I can handle that without to much hassle.
Trouble I was having when trying that before was getting it to use those values with the specific skills.
So would need to call for the skill from profile and then look for the attribute from a different database while still only concidering that skill.
My coding isn't quite that good yet but I am learning as I go lol
If you list them by skill name then you can get it's values by skill name eg.
Code: Select all
skillsdb = {
["MAGE_PLASMA_ARROW"] = {minlvl = 2, minxx =??},
["next skill"] = {minlvl = ??, minxx= ??},
}
then
Code: Select all
for k,v in pairs(settings.profile.skills) do
skilldata = skilldb[v.name)
if skilldata.minxx = player.Class1 and skilldata.minlvl > player.Level then
Get the picture?
Re: Need ideas on how to implement something
Posted: Mon Jan 10, 2011 10:53 pm
by lisa
I understand the concept which is a start lol
Bit I am struggling with is the actual database.
Do I add the code
Code: Select all
skillsdb = {
["MAGE_FIREBALL"] = {minlvl="11", minxx="4", primxx="1"},
}
Into the function file?
Or am I meant to create a file like skills.xml in the database folder?
I was assuming the code was in the same file as the function and it just called for the information but I can't seem to make that work.
Code: Select all
function checkskilllvl()
for k,v in pairs(settings.profile.skills) do
skilldata = skillsdb[v.name]
if skilldata.minxx == player.Class2 and
skilldata.minlvl > player.Level then
printf("FIRE BALL")
end
end
end
I changed the profile to only have the mage skill fireball listed and the charcters has mage as second class, so in theory it should work but it returns a nil value for skilldb which would tell me I haven't implented the database correctly.
Edit: Ok I got it all worked out now, the first code is actually creating a table, I added it into the top of the function, had a few little things needed to change here and there but I have it calling the right values from the table now.
Need to go to work now but I should be able to get a working version going later =)
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 12:36 am
by lisa
I am missing something again
Code: Select all
function checkskilllvl()
for k,v in pairs(settings.profile.skills) do
-- 1 warrior
-- 2 scout
-- 3 rogue
-- 4 mage
-- 5 priest
-- 6 knight
-- 7 warden
-- 8 druid
-- minxx = player.Class number to identify class
-- minlvl = required level before you can use skill
-- primxx = (class only skill = 2) or (Used by all classes = 1)
skillsdb = {
["MAGE_FIREBALL"] = {minlvl="4", minxx="4", primxx="1"},
["MAGE_FLAME"] = {minlvl="1", minxx="4", primxx="2"},
}
skilldata = skillsdb[v.Name]
printf(skilldata.minxx)
printf("space")
printf(player.Class1)
if skilldata.minxx == player.Class1 then
printf("FIRE BALL")
end
end
end
fireball is only skill in profile.
It prints '4space4' from the
Code: Select all
printf(skilldata.minxx)
printf("space")
printf(player.Class1)
So then it should really print 'FIRE BALL' aswell but it doesn't.
Edit:
Code: Select all
["MAGE_FIREBALL"] = {minlvl=4, minxx=4, primxx=1},
That fixed it.
Thanks for the help =)
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 2:23 am
by rock5
How can 2 values that look like 4 not be the same? Maybe 1 is a string and the other is a number?
I can just picture you scratching your head in frustration, "4 equals 4 so why the hell wont it print?". rofl
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 10:07 am
by lisa
Yes I did scratch my head going WTF how can 4 ~= 4, took me ages to work out what I did lol
I got a new project which I can't make sense of yet, along the same lines though.
I added a new attribute to that table of skills and put in the skill id, I am really liking this way of doing things =)
What I am trying to do is set the action bar according to the profile settings.
But the values returned by
Code: Select all
settings.profile.skills[k].hotkey
Have me at a loss on how to implement them into
Code: Select all
setActionKeyToId(settings.profile.skills[k].hotkey, skilldata.id)
because obviously the hotkeys returned arn't the numbers 2-9 like I want, they are actually 50-57.
My head just can't work this one out, I think I need more sleep lol
Now normally you could just say ok let priest skills be 2-5 and mage 6-9, that won't work in my case as I may need to use mage skills on 2-5. So I really need it to be using the settings.profile.skills[k].hotkey to set which skill goes where.
Edit: lol just had a crazy thought while sitting here looking at that, if 50 = 2 and 51 = 3 and so on I could try to -48 from the hotkey value. Seems to easy to work though lol
Aus server down, I'll just get some sleep and try it out tomorrow.
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 6:44 pm
by rock5
The actionKey is where you want to place the skill on the action bar. It has nothing to do with the hotkey. The hotkey is the key that you press to action the actionKey. What you want to do is place it on the action bar where you want it then read the hotkey value of that actionkey.
Say 'n' is where you decided to place a skill.
Code: Select all
setActionKeyToId(n, skilldata.id)
settings.profile.skills[k].hotkey = getHotkey(n + 87)
That's not taking into account modifiers.
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 7:16 pm
by lisa
I think I didn't explain what I was trying to do properly.
use this from profile
Code: Select all
<skill name="PRIEST_REGENERATE" modifier="" hotkey="VK_4" priority="60" />
to create this
Code: Select all
setActionKeyToId(4, skilldata.id)
I tested my -48 theory and it did the job, obviously if the profile has modifiers or isn't numbered 2-9 then things will get messy but for now the working code looks like this
Code: Select all
setActionKeyToId(settings.profile.skills[k].hotkey - 48, skilldata.id)
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 8:25 pm
by rock5
A bit messy because it makes assumptions. What's needed is a 'findActionKeyWithHotkey()' function which i didn't include.
But if your happy with that, that's fine.
Re: Need ideas on how to implement something
Posted: Tue Jan 11, 2011 8:34 pm
by lisa
After I've learnt a lot more about how the bot works and such I might revisit this problem, for now it does the job on what I wanted. The function will only be called once in the whole set of WP's. When I swap classes to the new class for the first time (10/1 to 1/1) I'll use it to set the action bar.