Page 1 of 2

knight punishment during partybot stops the bot

Posted: Sat Sep 07, 2013 8:09 pm
by amalia
hey all

While using partybot it occurs that knight punishment stops the bot. Without any errormessages.

skill debuggung is on

Code: Select all

	<option name="DEBUG_SKILLUSE"			value="true" />
The last thing the bot shows is "pressing macro: knight_punishment" + Debug message with gap details.

The skill punishment is called without any special attributes:

Code: Select all

	<skill name="KNIGHT_PUNISHMENT"     	hotkey="MACRO" priority="98" />	
It´s defined to be valid after 4 holy seals on target.

Code: Select all

	<skill name="KNIGHT_PUNISHMENT" 					id="490164" range="50"	type="damage"		casttime="0"	cooldown="8"	target="enemy"		reqbufftarget="target" reqbuffname="500140" reqbuffcount="4" />
the bot stops always (reproducable) when a partymeber kills the mob shortly before punishment would be cast. I never had this issue outside of a party.

I have in mind that this or a similar problem was already discussed, but I cannot find the thread nor do I know if it´s the same problem.

Any idea how I can go deeper in debugging this issue?

Re: knight punishment during partybot stops the bot

Posted: Wed Sep 11, 2013 5:20 am
by amalia
I get around this using punishment only above target hp >50%.
This makes the issue occure rarely.

But aren´t there any more debug switches to make the bot write down what it´s actually doing? To see where it stops exactly? May be it´s only catched
in a loop...

Re: knight punishment during partybot stops the bot

Posted: Wed Sep 11, 2013 5:55 am
by rock5
It's hard for me to debug this because I'm not familiar with the party code and I'm not sure how it's supposed to act. There is not really enough information to even guess where to look. If it was easy to reproduce and I could reproduce it I could probably eventually figure it out. But I don't think I can do it remotely. Maybe Lisa, who knows the party bot best, will know where the problem is.

Re: knight punishment during partybot stops the bot

Posted: Wed Sep 11, 2013 5:21 pm
by lisa
party bot uses the player:fight() to do all of the combat stuff, so issue would need to be resolved in that function.

Code: Select all

				if player:target(player:findEnemy(true, nil, evalTargetDefault)) then
					if heal then
						healfight()
					else
						player:fight()
					end
				end

Code: Select all

				if player:target(player:findEnemy(nil, nil, evalTargetDefault, player.IgnoreTarget)) then
					player:fight();
				end

Code: Select all

				player:target(player:findEnemy(nil,nil,icontarget,nil))
				if player:haveTarget() then
					if heal then
						healfight()
					else
						player:fight()
					end
				end

Code: Select all

				local leader = getPartyLeaderName()
				if leader then
					local mob = getTarget(leader)
					if mob and mob.Type == PT_MONSTER then
						player:target(mob.Address)
						if heal then
							healfight()
						else
							player:fight()
						end
					end
				end

It seems to me that the mob is being killed in the time the knight bot tries to attack it?

Re: knight punishment during partybot stops the bot

Posted: Thu Sep 12, 2013 12:37 am
by rock5
Well the user said it only happened when he party botted and there are loops in the party code. I just couldn't figure out the logic on how it could get stuck. Maybe if the hp wasn't 0 like happens with some mobs? But then why does it only happen with that skill? We might have to post a version of party.lua and/or player.lua with some print messages to see where it's getting stuck. And then work from there.

Re: knight punishment during partybot stops the bot

Posted: Thu Sep 12, 2013 3:48 am
by lisa
One of the main differences with party bot and normal is that you are in a party and there are other characters killing the same mob, when normal botting the mob only dies when you kill it (usually).

Party bot always checks if the mob is still valid before trying to attack it and when it goes into the player:fight() code it comes out of that function when mob dies or the bot deems it useless trying to fight it. ie. taking to long to kill.

Give this version a try, functionality is same as latest version but it has debug prints.
Add a profile option
DEBUG_PARTY

Newer version couple posts down.

ie

Code: Select all

<option name="DEBUG_PARTY"				value="true" />
--=== Added ===--
Completely untested, I don't even have 1 PC with up to date version of the game.

Re: knight punishment during partybot stops the bot

Posted: Thu Sep 12, 2013 6:48 pm
by amalia
I´ll check and report

Thanks for now.

Re: knight punishment during partybot stops the bot

Posted: Fri Sep 13, 2013 7:46 am
by amalia
Hey Lisa

With your debug flag an the modified party.lua I get an error: ....\party.lua attempt to call global 'debug_party' (a nil value).
But only (of course) with those party members that are in party_dps, or party_heal mode. Not the Party leader.

I´ll put the knight as the party leader so that it does not use the party_bot code (Is this assumption right?) and will see. If code of party bot causes the error or if the problem just occurs while beeing in a party at all.

edit: Yes it occurs also as party leader. Bot stucks again. Means no problem on the party bot code? Need the debugging flags somewhere else?

Re: knight punishment during partybot stops the bot

Posted: Fri Sep 13, 2013 8:00 am
by rock5
You see this function at the bottom of the file?

Code: Select all

local function debug_party(_reason)
	if settings.profile.options.DEBUG_PARTY then
		cprintf(cli.yellow, "[DEBUG] ".._reason.."\n");
	end
end
Try moving it to the top of the file.

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 2:14 am
by lisa
I moved it to top in this version, I was hoping the function would be included before it was called, guess I didn't check it all properly.
I did it at end so that if SVN updates wouldn't get all messed up.

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 6:05 am
by amalia
Ok Debug-messages work proper.

The bot stucks during: "In Combat find out why and kill it"
Then some skills are used and with punishment it stucks.

Since it also stuck when knight is partyleader and is following some waypoint instead beeing party-assistent (the other party-member are assistent bots) we should consider that it might not be a problem of partybot-code.

I also can see, that the bot is not stucking completly. It just stops following waypoints, no written output and stop using skills. But e.g. I can still pause and resume the bot. And if I target a mob manually with "tab" during this phase of "stucking" the char is still moving towards the mob and is attacking with the "attack". But is not using any skills. I mean I just target the mob I do not attack it. moving and Attacking comes from the bot. So there is still something living inside :-)

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 6:38 am
by lisa
that debug message is after

Code: Select all

if player:target(player:findEnemy(true, nil, evalTargetDefault)) then
So yeah it is using the evaltarget default function, so issue is in the way the main bot deals with something, might need a check for valid mob in the player:fight() somewhere.

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 7:49 am
by rock5
lisa wrote:

Code: Select all

if player:target(player:findEnemy(true, nil, evalTargetDefault)) then
So yeah it is using the evaltarget default function
We are talking about a situation where the mob is targeted and the mob is dead. It looks like to me that the code at the top of findEnemy would return the currently targeted dead mob without using the eval function.
amalia wrote:And if I target a mob manually with "tab" during this phase of "stucking" the char is still moving towards the mob and is attacking with the "attack". But is not using any skills.
That really makes it seem like there is a problem in player:fight. I think you're right Lisa
lisa wrote:might need a check for valid mob in the player:fight() somewhere.

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 10:07 pm
by lisa
Hmm the while loop is for when it has a target, so the current code "should" be working, unless you target yourself, in which case the target would be alive but you can't attack it.

Maybe the whole issue is you target yourself mid fight?

So maybe check your target is the original target before starting the loop and if not then check it is still valid and if so target it again?

Re: knight punishment during partybot stops the bot

Posted: Sat Sep 14, 2013 10:20 pm
by lisa
Ok I changed the timed attack function a bit, give this a try.


It used to just check if you had any target at all, I changed it to check if you are still targeting the original target.

I think more needs doing but this will atleast stop the attack timer function if you target yourself mid fight.
player.lua
(127.57 KiB) Downloaded 144 times

Code: Select all

	local function timedAttack()
		self:updateTargetPtr();

		-- Prevents looting when looting is turned off
		-- (target is dead, or about to be dead)
		if self.TargetPtr ~= original_target.Address then
			return
		else
			original_target:updateAlive()
			if not target:isAlive() then
				return;
			end
			Attack()
		end;
	end
Also made a check for target is the original target.

Code: Select all

		self:updateTargetPtr();
		if original_target:isAlive() and self.TargetPtr ~= original_target.Address then
			player:target(original_target)
		end;
Might need some more thinking but it's a start, that will do me for now, Rock might be able to finish off anything I messed up.

Re: knight punishment during partybot stops the bot

Posted: Tue Sep 17, 2013 4:12 pm
by amalia
I tried.

The bot kills one mob and ends like this.
../rom/classes/player.lua:1780: attempt to index global 'target' (a nil value)
I have no idea to avoid this to check the rest.

Re: knight punishment during partybot stops the bot

Posted: Tue Sep 17, 2013 4:45 pm
by BlubBlab
you need something like this before the line

Code: Select all

local target = self:getTarget();
The target is not global anymore since RC2

Re: knight punishment during partybot stops the bot

Posted: Wed Sep 18, 2013 2:34 am
by lisa
My bad, I changed it to "original_target" and didn't look for more "target" after the loop.

Try this
player.lua
(127.6 KiB) Downloaded 127 times

Re: knight punishment during partybot stops the bot

Posted: Wed Sep 18, 2013 7:18 am
by amalia
I´ll keep on it but actually I cannot run 4 clients beneath each other like I used to do. Because one client is always critting after few minutes. Nothing to do with the bot, but frustrating anyway and with less dds in party the issue does not occur that often.

As far as I see the issue is still there. Bot stops after punishment when mob is nearly down.
But It looks like it stops completly. It is not going to move and to attack after tabbing to the next mob like it behaved the last time.
But I did not check the different versions against each other again, it was too annoying with the critting clients for the moment.
The party_debug message is still "In combat found out why, kill it now."

Re: knight punishment during partybot stops the bot

Posted: Thu Sep 19, 2013 1:10 am
by MinMax
The same trouble. Running party, a client crashes every minute. Curiosly only the followers.Not the leader. The partybot worked excellent for a long time. Till we got the new zone. I don´t get errors of the bot, but i have the clientt crashes. I updated all. Micromacro, rombot, functions, addons... Ineffective.
6 Clients standalone with the bot no problem. 3 in a party with minute by minute crash.