Siege buff bot

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Siege buff bot

#21 Post by lisa » Tue May 06, 2014 8:37 pm

well distance seems to be exactly 105, so setting them to 100 should be fine

Code: Select all

Command> player:update() local target = CPawn.new(player.TargetPtr) target:update()  print(distance(player,target))
105.31731050756

Now the painful part, which skills are party wide skills???

I have heard of champion skills but never played a champ so no idea there, I know of the priest and mage generic ones but I am just going to assume there is quite a few I don't know.

*pokes ZZZZZ*
Can you list the party wide skills for me ;)

Actually test this for me too.
skill.lua
classes folder
(24.41 KiB) Downloaded 178 times
database.lua
rom folder
(8.73 KiB) Downloaded 196 times
Just adjust the skills you want in the skills.xml

example.

Code: Select all

<skill name="MAGE_FIRE_WARD"						id="490248" range="100"	type="buff"			casttime="0"	cooldown="0"	target="party"		buffname="500366" />
so target is "party" and range is "100"
I assumed the range checks would do the job for if out of range and so I didn't add in any more distance checks, this would need testing though.
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

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

Re: Siege buff bot

#22 Post by lisa » Tue May 06, 2014 9:50 pm

did some testing and it works as you would expect it to work.

1 main issue, if there is something between you and party member and still within 100 yards then it just keeps trying to buff you constantly. I don't mean a little bump on the ground like damage skills I mean like an actual wall or similar.
It shouldn't be an issue but it is something to keep in mind.

Biggest problem I see is the P/K elite which makes grace of life to be party wide instead of target specific, so it has range set to 200. There is nothing in bot to handle it being a party wide skill, it just uses it as if it is a target specific skill and range is still 200, I will need to test the actual range of the party wide version. It's an issue with the skill itself and not really with party skills but thought I would mention 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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#23 Post by ZZZZZ » Tue May 06, 2014 10:21 pm

Code: Select all

	<skill name="PRIEST_MAGIC_BARRIER" 					id="491166" range="0"	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="500548,501877" />
	<skill name="MAGE_FIRE_WARD"						id="490248" range=""	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="500366" />
	<skill name="PRIEST_EMBRACE_OF_THE_WATER_SPIRIT" 	id="491323" range="0"	type="buff"			casttime="0"	cooldown="0"	target="friendly"		buffname="501778" />
	<skill name="PRIEST_SHADOW_FURY" 					id="492932" range="0"	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="503196" />
	<skill name="ROGUE_QUICKNESS_AURA" 					id="491536" range="0"	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="501932" />
	<skill name="DRUID_CONCENTRATION_PRAYER" 			id="493530" range="0"	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="503799" />
	<skill name="DRUID_MYSTERIOUS_GRACE" 				id="494372" range="100"	type="buff"			casttime="0"	cooldown="0"	target="friendly"		buffname="505165" />
	<skill name="DRUID_AWAKENING_OF_THE_WILD"			id="494364"	range="100"	type="buff"			casttime="0"	cooldown="0"	target="friendly"  		buffname="620434" />
	<skill name="WARLOCK_SUBLIMATION_WEAVE_CURSE" 		id="498914" range="0"	type="buff"			casttime="0"	cooldown="0"	target="self"		buffname="621736" />

Those are the only ones I can think of currently. Didn't add grace of life to that list for the same reason you bought it up.

~~ edit

Thought of a way you could deal with Enhanced Grace. Even though the actual skill doesn't change, the player that is casting it has the elite skill 'Enhanced Grace of Life' id = 492355. Would it be possible to check for that elite in a preSkillCast situation, and if its there, Grace target = "party" else = "friendly"?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#24 Post by rock5 » Wed May 07, 2014 12:12 am

lisa wrote:Pretty much first thing it does is check "if target == nil", target is the second argument, funny thing is target is never nil, ever. So all of the checks are pretty much stuffed from the get go.
I'm not sure I follow. "if target == nil" just makes sure the target variable has a value. The bot may always use it but it was made backward compatible by checking if it's nil and if so, create it.

This basically happens if you don't have anything targeted. The only difference I can see between doing the code in that "if" statement and not doing the code in that "if" statement is the Id and Type get changed from -1 to 0 (the purpose of the 2 values is -1 means it is newly created and not unupdated and 0 means it's updated but has no valid value or it's not a valid object anymore). I can't see anything in the code that would perform differently if those values change.

But if you were to check the target you wouldn't use race. Address is probably the best to check. And you could probably check if Id or Type changing actually causes it to work by skipping the contents of that "if" statement and just changing Id and/or Type to 0 and seeing if that still works. Eg.

Code: Select all

if target == nil or target.Address == 0 then
    target.Id = 0
    target.Type = 0
end
if that works then we'll have to go through the code with a more fine toothed comb to figure out why.
lisa wrote:Party wide buffs are usually geneneric when it comes to benefit to classes, they add hp or defence or magic resistance, not sure there is any that specifically benefit one type of class.
You're probably right. I think I was thinking of a "friendly" buff that helped physical attackers. Don't remember what it's called though.
lisa wrote:Now the painful part, which skills are party wide skills???

I have heard of champion skills but never played a champ so no idea there, I know of the priest and mage generic ones but I am just going to assume there is quite a few I don't know.
I dusted off an old Excel doc I have that has all the offsets and their values for me to do comparisons. Looks like offset 0xA4 is 2 for all party skills. If that turns out to be true I could rerun the program that updates this list and give you a list of all the party skills.
lisa wrote:Biggest problem I see is the P/K elite which makes grace of life to be party wide instead of target specific, so it has range set to 200. There is nothing in bot to handle it being a party wide skill, it just uses it as if it is a target specific skill and range is still 200
Do you mean it also casts on party members that are no in memory range? Can the bot check if a party member not in range has a buff?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Siege buff bot

#25 Post by lisa » Wed May 07, 2014 12:41 am

rock5 wrote:I'm not sure I follow. "if target == nil" just makes sure the target variable has a value. The bot may always use it but it was made backward compatible by checking if it's nil and if so, create it.
Issue was that I did have a target every time and it was still printing what I posted earlier, so when it did the check for target.InParty it would always be false. So now I changed the if statement it now updates the pawn for target and so now it actually works as it should.

rock5 wrote:Do you mean it also casts on party members that are no in memory range? Can the bot check if a party member not in range has a buff?
Nope, I mean it goes from target friendly and 200 range to "possibly" 100 range and being applied to party members.

I wouldn't be to worried about the offset, just change the specific skills in the database to be party and range 100.
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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#26 Post by ZZZZZ » Wed May 07, 2014 1:25 am

100 and party works fine for all the skills I have seen so far, thanks lisa :)

Looking at how to check what buffs they have and compairing to skills in profile has lost me now.

1: How do you find out what position in a raid you are? I can make a table of everyone in raid with

Code: Select all

local raidTable = {}
	for i = 1, 36 do
		_name = GetPartyMemberName(i)
		--print(_name)
		table.insert(raidTable, _name)
	end
The issue with that is GetPartyMemberName() will not return the name when its the actual player in that slot. eg 7 characters in raid, raid slot 2 is the char running it, it'll add all the characters names to the table except for raid2, which will return nil. I can't even find the function to try and alter it.

2: if I use target:updateBuffs(), how would I follow up that with a function that checks if they need a party buff or not? I tried making a list,

Code: Select all

function partySkillsList(_skillarg)
	if (_skillarg == "PRIEST_MAGIC_BARRIER"
		or _skillarg == "MAGE_FIRE_WARD"
		or _skillarg == "PRIEST_EMBRACE_OF_THE_WATER_SPIRIT"
		or _skillarg == "PRIEST_SHADOW_FURY"
		or _skillarg == "ROGUE_QUICKNESS_AURA"
		or _skillarg == "DRUID_CONCENTRATION_PRAYER"
		or _skillarg == "DRUID_MYSTERIOUS_GRACE"
		or _skillarg == "DRUID_AWAKENING_OF_THE_WILD"
		or _skillarg == "WARLOCK_SUBLIMATION_WEAVE_CURSE") then
			return true
	end
end
but im not sure how I can compare their buffs (or lack of) with the buffs player has.

I tried looking through the :checkSkills() function but I cannot figure out how that goes through players buffs, looks more like something to deal with attacking than anything.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#27 Post by rock5 » Wed May 07, 2014 1:58 am

lisa wrote:Issue was that I did have a target every time and it was still printing what I posted earlier, so when it did the check for target.InParty it would always be false.
Um... That might be because you didn't update TargetPtr. I think it's because checkSkills assumes that PlayerPtr is up to date (avoid needless update). Probably somewhere it's not being updated. We could add updatePtr to canUse but that would mean it would always be recreating target when you don't have anything targeted. I think the way it's supposed to work is canUse should always be called with a target object whether valid or not. That way it doesn't get needlessly created. If you have something targeted then 'target' should be valid and the player.TargetPtr should be up to date. The "if nil" is just for backward compatibility in case a user used it without including the target. I'll see if I can find somewhere checkskills is used where it doesn't update the targetptr.
lisa wrote:Nope, I mean it goes from target friendly and 200 range to "possibly" 100 range and being applied to party members.
So you mean it just changes from a target specific to party skill. We could probably handle it one of the ways we handle the other skills that change other skills. I can't tell which elite you are talking about. I see Devotion Halo but that is a differently named skill.
lisa wrote:I wouldn't be to worried about the offset, just change the specific skills in the database to be party and range 100.
I wasn't suggesting that you use the offset in the bot. I was just pointing out that I could provide a list of all the skills that need changing.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Siege buff bot

#28 Post by lisa » Wed May 07, 2014 2:01 am

So as to make it easier to use the same WP for all classes I would still use the skills in profile but I wouldn't use player:checkSkills()

So you would target the player and then go through your skills
settings.profile.skills
and check skill:canUse() and if that is true then just cast the skill.

As for the raid usage and moving people around I would have to look up the in game functions for it, I did some work on an autoinvite addon a long time which you could save the positions of where people are in raid. So before SW you would invite everyone and move them to where you wanted and then once it's set you disband raid. Then once in SW you click a button and it invites everyone and then automatically moves them to their saved position. It had a few issues but they were issues from the game itself.
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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#29 Post by rock5 » Wed May 07, 2014 2:29 am

lisa wrote:So you would target the player and then go through your skills
settings.profile.skills
and check skill:canUse() and if that is true then just cast the skill.
Isn't that basically what checkSkills does?

I think the easy fix for the original problem is to do a pointer update in checkskills. Change
local target = target or CPawn.new(self.TargetPtr);
to,

Code: Select all

	player:updatePtr()
	local target = target or CPawn.new(self.TargetPtr);
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: Siege buff bot

#30 Post by lisa » Wed May 07, 2014 2:48 am

Except using checkskills you wouldnt be able to do your own check for if the player needs moving within the raid to your specific group in the raid in order to get the buff.

So in the table check of skills you would check if v.target == "party" and if it is then you would check if the target has the required buff or not and if not then it needs moving to your group within raid.

So yeah I guess skill:canUse() wouldn't be ideal.


Maybe easiest thing would be to do through skills and if target == "party" and check if they have the required buff, if they don't then move the player to your group. then do player:checkSkills() on them. If you do through all skills and find they don't need a party buff then just do player:checkSkills without moving them.

End of the day that is probably the easiest solution.

Code: Select all

function partybuffcheck()
	local buffdone = false
	for k,v in pairs(settings.profile.skills) do
		if v.Target == STARGET_PARTY then
		
		-- move the player
		player:checkSkills(true)
		buffdone = true
		-- move player back
		break
	end
	if not buffdone then
		player:checkSkills(true)
	end
end
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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#31 Post by rock5 » Wed May 07, 2014 5:48 am

Ok. There is that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#32 Post by ZZZZZ » Wed May 07, 2014 6:44 am

I have tried putting that into my siegebuff function just as a simple platform to test with. So far this is the part I have been talking about:

Code: Select all

if buffThem then
					player:target(obj)
					player:update();
					if (player:haveTarget() ~= nil) then
						player:update();
						local target = player:getTarget()
						target:update()
						target:updateBuffs()
						local doParty = false
						if (RoMScript('UnitIsRaidLeader("player")') or RoMScript('UnitIsRaidAssistant("player")')) then
							for i,v in pairs(settings.profile.skills) do
								print(v.BuffName)
								if ZZuseSkill(target, v) then
									doParty = true
									break
								end
							end
						end
						
						if doParty then
							for i, v in pairs(raidTable) do
								if target.Name == v then
									oldPos = i
									break
								end
							end
							for j = 31,36 do
								if raidTable[j] == "" then
									newPos = j
									break
								end
							end
							repeat
								RoMScript("MoveRaidMember("..oldPos..","..newPos..")")
								yrest(300);
							until GetPartyMemberName(newPos) == target.Name
						end
						player:checkSkills(true)
						player:checkPotions()
						table.insert(buffedTable, obj.Name)
						if doParty then
							RoMScript("MoveRaidMember("..newPos..","..oldPos..")")
						end
					end
				end
It works just how I want it to, but the last issue I am having is to do with the players buffs and those that your target has. The function ZZuseSkill(target, v) -

Code: Select all

function ZZuseSkill(_target, _skill)
	if _skill.Type == STYPE_BUFF and _skill.BuffName ~= "" and _skill.Target == STARGET_PARTY then
		if _target:hasBuff(_skill.BuffName) then
			--print("Target is buffed, ignore")
			return false
		else
			print("Buffing target")
			return true
		end
	end	
end	
Because I have all the class skills in profile together (eg, d/w and d/wd), and say im on d/w, it'll check if they have the d/wd buff for Mysterious Grace too, and seeing as it's not even a buff I can use on d/w, it'll always pull them into party anyway, even if it doesn't buff anyone once they get there. Is there a check like hasSkill or such?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#33 Post by rock5 » Wed May 07, 2014 7:05 am

When the skills get loaded it checks to see if they are available. If they are not it sets a sub value "Available" to false. So just add a "if v.Available then" somewhere and it should ignore unavailable skills. Actuallly it should be the first thing you check in ZZuseSkill.

Code: Select all

if _skill.Available and _skill.Type == STYPE_BUFF and _skill.BuffName ~= "" and _skill.Target == STARGET_PARTY then
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#34 Post by ZZZZZ » Wed May 07, 2014 7:17 am

Oh right...is there a database of all these things at all? xD

and turns out I lied, still 1 more issue that I forgot. Its to do with finding your position in a raid still. I can get a table of all party members and switch them when needed, but I can't find where the player is (just comes up nil), meaning that making sure the player isn't switched with the 1 its trying to buff causes some issues.

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

Re: Siege buff bot

#35 Post by lisa » Wed May 07, 2014 8:02 am

ZZZZZ wrote:Its to do with finding your position in a raid still
If you know for sure the player will be in last group, 31-36 you could use
http://runesofmagic.gamepedia.com/API:GetRaidMember

Code: Select all

local playerpos = 0

                     for j = 31,36 do
if playerpos == 0 and RoMScript("GetRaidMember("..j..")) == player.Name then playerpos = j end
                        if raidTable[j] == "" then
                           newPos = j
                           break
                        end
                     end
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

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#36 Post by ZZZZZ » Wed May 07, 2014 8:33 am

I did try using that function, but it was quite slow because I needed it to check all slots. Simply had to make sure player was moved to the last raid slot before it started buffing players. I guess if its only going to be used once to make sure its there then that would be fine, but at the same time if it got moved or such then it would screw it up. Eh i'll just mess around with stuff for a while and see what I I can come up with.

Big thanks once again to both Lisa and R5 for the assistance :)

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#37 Post by rock5 » Wed May 07, 2014 8:50 am

It takes time because it does multiple RoMScripts. If you do only one, it will be a lot faster.

Code: Select all

newPos = RoMCode("for i=1,36 do if GetRaidMember(i)==\"".. player.Name .."\" then a=i break end end")
That should do it and it should be very fast.

Notes:
  • 1. I'm using RoMCode because I'm doing some code, not just running a function or getting a value.
    2. RoMCode doesn't usually return values but if you want to, you set the value to 'a' and that will be returned. Or in the case of multiple values, you put them in a table first and assign it to 'a'.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#38 Post by ZZZZZ » Wed May 07, 2014 10:16 am

Crap you showed me that when I had my issue with finding fire training or soldiers attack titles..should have remembered :/ Thanks again.

This works spot on for making sure player is always in group 6

Code: Select all

function stayInLastRaidGroup()
	local oldPos = RoMCode("for i=1,36 do if GetRaidMember(i)==\"".. player.Name .."\" then a=i break end end")
	local newPos
	local raid6clear
	for i = 36, 31, -1 do
		raid6clear = GetPartyMemberName(i)
		if raid6clear == nil then
			newPos = i
			break
		end
	end
	if 31 > oldPos then
		RoMScript("MoveRaidMember("..oldPos..","..newPos..")")
	end
end	
** Definitely going to keep using that RoMCode, can make so many thing heaps faster.

Code: Select all

RoMCode('inraid = UnitInRaid("player"); canmove = UnitIsRaidLeader("player") or UnitIsRaidAssistant("player"); if inraid and canmove then a=canmove end')
Was using 3 RoMScripts lol, Code cut time down heaps.

ZZZZZ
Posts: 513
Joined: Sun Oct 21, 2012 1:42 am

Re: Siege buff bot

#39 Post by ZZZZZ » Wed May 07, 2014 11:20 pm

rock5 wrote:Or in the case of multiple values, you put them in a table first and assign it to 'a'.
Is it possible to return multiple values to a table without reverting to running Script for each value?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Siege buff bot

#40 Post by rock5 » Wed May 07, 2014 11:52 pm

Yes. You are only limited by the length of the command you use. The macros in game can only be 255 characters long. You are also limited, of course, to returning only numbers, strings and booleans in the 'a' table.

Here is a quick example looking for 2 names.

Code: Select all

local pos1, pos2 = RoMCode("for i=1,36 do z=GetRaidMember(i) if z==\"".. name1 .."\" or z==\"".. name2 .."\" then table.insert(a,i) end end")
The problem with this is you can't really deal with a table of random names, you could but the command would be much longer. Also you'll need to find a way to match up the returned values with the names if that's needed.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest