Page 1 of 1

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 10:15 am
by lisa
thought I would post this here since you are doing updates and stuff.

skill.lua line 666ish has the function unnopmouse(), it needs a yrest(500) at the end of it, line 682ish.

What happens is if you use a target ground aoe skill and it kills everything then it goes to cleartarget straight away but the targetPtr is still frozen and so it goes into this endless loop.

Obviously not ideal solution, ideally would have the rest only if all targets are killed in that single skill cast but I don't have the time to work out how to implement that lol

I must say though I am loving the thunderstorm on my mage.

--=== Added ===--

Nope the rest didn't fix it, going to need to add a variable and check it in cleartarget, not sure how else to do it.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 7:27 pm
by rock5
targetPtr only gets frozen in the "Attack()" function and only for objects that don't maintain a target such as harvestables and objects, not mobs. Are you saying it get stuck in a loop doing cleartargets?

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 7:56 pm
by lisa
adding a variable didn't fix it either, still trying to pinpoint the cause but it is only when bot uses thunderstorm and kills all mobs it is trying to kill in that 1 attack and then does cleartarget

Code: Select all

Use MACRO: MAGE_THUNDERSTORM   =>   Ousul Salamander (0/16191)
Fight finished. Killed 11 Ousul Salamander. (fight #120 / runtime 28 minutes)
Clearing target.
---stuck here
Paused. (Delete) to continue, (CTRL+L) exit to shell, (CTRL+C) quit
Resumed.
Moving to waypoint #127, (2342, 2949)
Stopping waypoint: Target acquired before moving.
Engaging enemy [Ousul Salamander] in combat.
Use MACRO: MAGE_THUNDERSTORM   =>   Ousul Salamander (0/16191)
Fight finished. Killed 12 Ousul Salamander. (fight #121 / runtime 529 minutes)
Clearing target.
It is an infinite loop as it sat like that for 8 hours.

with the variable I added it isn't every time anymore, just occasionally, before the variable it was every single time I killed all mobs in that 1 attack.

all i did was add this to cleartarget

Code: Select all

if PTRnoped then unnopmouse() end
made the unnopmouse function global, added in the value change in the nop and unnop, forgot to add a return after the function call. That might be why it still got stuck.

I'll do some testing a bit later today if I get the time.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 8:28 pm
by rock5
I don't think the problem is that the mouse is noped. I can't see why that would cause a problem. All it would mean is you wouldn't be able to manually click anything in game. When it got "stuck" did you test the mouse in the game?

I think what you are saying is after it does the cleartarget it gets stuck. Trying to find where in the code it gets stuck might be a bit difficult though. I'm not able to reproduce the problem.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 9:36 pm
by lisa
rock5 wrote:I'm not able to reproduce the problem.
you could probably take a mage with thunderstorm to a low level area and just set it to wander or something so it casts the aoe and kills things instantly, that might reproduce it.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 9:46 pm
by rock5
That's exactly what I did. It didn't do it.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 10:16 pm
by lisa
ok managed to get it with debug settings, all, set to true.

Code: Select all

[DEBUG] 597161216 target dist > MAX_TARGET_DIST with battling from other mob
Clearing target.
[DEBUG] FightStartX 2476.2648925781 FightStartZ 1527.23046875
[DEBUG] dir_FS->WP rad -0.195 dir_FS->FE rad -0.070
[DEBUG] Line FS->WP / FS->FE: angleDif rad 0.125 grad 7
[DEBUG] We (would) pass(ed) wp #109 (dist 52.7) in a dist of 6 (skip at 100)
and all prints stopped there, just sitting there now

I can move around by clicking the mouse, I targeted a mob and it did a print of distance and still sat there not doing anything else. I attacked the mob and killed it, bot then continued on with the WP, to many prints to get the actual print after it started again.

It has to be stuck in a loop somewhere for all prints to stop.

Re: Heads up! Big update comming. Looking for testers.

Posted: Sun Nov 11, 2012 10:45 pm
by lisa
ok stuck again, looked like this, it stopped at clearing starget, I did the targets manually.

Code: Select all

Use MACRO: MAGE_PURGATORY_FIRE [DEBUG] gap between skilluse 6325, pcasting=false=>   Ousul Salamander (0/16191)
Clearing target.
--stopped here
[DEBUG] 630042368 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 119601664 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 630042368 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 119601664 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 119596544 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 119599104 target dist > MAX_TARGET_DIST with battling from other mob
[DEBUG] 630041088 target dist > MAX_TARGET_DIST with battling from other mob
ok those prints are only done when player.Battling is true, 3 places with this code

Code: Select all

		if( player.Battling == true  and		-- we have aggro
		target.TargetPtr ~= player.Address ) then	-- but not from that mob
			debug_target("target dist > MAX_TARGET_DIST with battling from other mob")
			return false;
		end;
which are all in the evaltargetdefault code in player.lua

So it isn't updating the combat flag?

cleartarget issue

Posted: Sun Nov 11, 2012 10:47 pm
by lisa
Ok so I added prints before every single usage of the evaltargetdefault, this is the bit where I start to pull out my hair. I get the message

Code: Select all

[DEBUG] 630042368 target dist > MAX_TARGET_DIST with battling from other mob
which is only in the targetdefault function but I am not getting any of the prints I added to where the targetdefault is called, so it is being called but not from where I added prints?

I am thinking need to approach this from the useskill for target ground aoe as it is only happening with using thunderstorm.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 2:08 am
by lisa
OK so after putting prints absolutely everywhere I could think of I have this info to add.

The cleartarget is ALWAYS from bot.lua line 524

Code: Select all

		if( player.TargetPtr ~= 0 and not player:haveTarget() ) then
			player:clearTarget();
		end
the evaltargetdefault is ALWAYS from player.lua line 1634

Code: Select all

	-- Loot any other dead monsters nearby
	self:update()
	if not self.Battling or not self:findEnemy(true,nil,evalTargetDefault) then
		self:lootAll()
	end
lootAll() isn't called, debug settings are true and no prints from it when it gets stuck.
So in order to do the findenemy it needs to think self.Battling is false but in the evaltargetdefault it is doing prints that are only done if player.Battling is true.

It sometimes also prints "Error in reading memory" which comes when memoryreadrepeat fails from pawn.lua line 239

Code: Select all

	if( settings.options.DEBUGGING ) then
		print("Error in memory reading");
	end

apart from that I got absolutely nothing.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 3:57 am
by gloover
Hey lisa.

I have posted this problem allready in this thread

Have checked everything point by point - onleavecombat, target distance -... Now, I think I got it! Your are using your "madman" addon, dont you?
I have deleted this madman code fragment from my "onSkillCast" - since then it doesnt stuck anymore. The "reading in memory"-error cames from time to time - but the bot isnt stucking!

Re: cleartarget issue

Posted: Mon Nov 12, 2012 4:42 am
by lisa
nope no madman addon at all, not doing DoD so I don't have it in addons folder unless I do DoD.

No code in profile for it either.

I notice you never answered my last post on that topic.

For me the memory read error is after getting snuck, a good 10+ seconds later, so I doubt it is the actual issue here.

What worries me is that all debug prints stop but if I target something it instantly posts the to far away debug message. So there is a loop somewhere that is checking for target with evaltargetdefault but is in a loop with no debug messages.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 4:49 am
by rock5

Code: Select all

   if not self.Battling or not self:findEnemy(true,nil,evalTargetDefault) then
      self:lootAll()
   end
lisa wrote:So in order to do the findenemy it needs to think self.Battling is false but in the evaltargetdefault it is doing prints that are only done if player.Battling is true.
No that's not right. It only does the findEnemy if Battling is true. If player.Battling were false then "not self.Battling" would be true so it wouldn't check the other 'or' part because it doesn't need to. What it means is, if you aren't battling or if you are battling but you can't find any valid mobs attacking you then lootall. The fact that it doesn't do the lootall means it thinks you are battling and there is a valid mob attacking you. If there is nothing attacking you and you are getting readmemory errors then maybe your problem is not a programing bug but a memory reading issue.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 5:20 am
by lisa
Ahh yup I was thinking it was "and" and not "or" my bad

I may have come across something, doing more testing but I managed to last 30 mins of no getting stuck.

I think it might actually be the pawn.inParty flag, still testing to narrow down the exact issue though, indications are this atm

Code: Select all

target:getTarget().InParty

Re: cleartarget issue

Posted: Mon Nov 12, 2012 6:10 am
by rock5
That seems a possibility. Evaluating friendly aggro is done differently in different places. Maybe in one place it decides a target is valid and in another it decides it isn't so it's stuck in a loop but never attacks. But still, are you in a party or have a pet?

You know this may all be obsolete once I release the new version. I did a lot of changes to the way it does targeting that it may already be fixed. I think it's about time I release a version to the public, an RC1 version. :)

Re: cleartarget issue

Posted: Mon Nov 12, 2012 8:19 am
by lisa
technically I am in a party but other party member is not even on same map, I do have an egg pet but not any other pet.
rock5 wrote:You know this may all be obsolete once I release the new version
not sure if to be happy or not happy, spent way to much time on this today.

Had it running for 2 hours with no stucks.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 9:07 am
by rock5
lisa wrote:Had it running for 2 hours with no stucks.
If you know what you had to do to fix it, I can have a look to see if it's fixed in the new version.

Re: cleartarget issue

Posted: Mon Nov 12, 2012 10:09 am
by lisa
bot.lua line 609

Code: Select all

		while(player.Battling) do

			if( player.Current_waypoint_type == WPT_TRAVEL ) then
				cprintf(cli.green, language[113]);	-- we don't stop and don't fight back
				break;
			end;

			if ( settings.profile.options.PARTY ~= true  ) then

				player:target(player:findEnemy(true, nil, evalTargetDefault, player.IgnoreTarget));

				-- wait a second with the aggro message to avoid wrong msg
				-- because of slow battle flag from the client
				if( msg_print == false  and  os.difftime(os.time(), aggroWaitStart) > 1 ) then
					cprintf(cli.green, language[35]);	-- Waiting on aggressive enemies.
					msg_print = true;
				end;
				if( player:haveTarget() ) then
					if( msg_print == false ) then
						cprintf(cli.green, language[35]);	-- Waiting on aggressive enemies.
						msg_print = true;
					end;

					break;
				end;

				if( os.difftime(os.time(), aggroWaitStart) > 4 ) then
					cprintf(cli.red, language[34]);		-- Aggro wait time out
					break;
				end;

				yrest(10);
				player:update();
			else
				player:target(player:findEnemy(true, nil, nil));
				local target = player:getTarget();
				if player:haveTarget() then
					if( settings.profile.options.ANTI_KS ) then
						if( target:haveTarget() and
							target:getTarget().Address ~= player.Address and
							 (not player:isFriend(CPawn(target.TargetPtr))) and
							target:getTarget().Address ~= 0 -- because of distance limitation
							and target:getTarget().InParty ~= true )then
								cprintf(cli.red, language[5], target.Name);
						else
							player:fight();
						end

					else
							player:fight();
					end
					yrest(10);
					player:update();
				end
			end
		end
If party is true then it does the code after the else, if it doesn't have a target then it never does a player:update() so it stays in the while player.Battling loop.

moving the player:update() to after the player:havetarget end should fix it.

Code: Select all

					else
							player:fight();
					end
				end
				yrest(10);
				player:update();
			end
		end
You have no idea how painful it was to find this lol

Re: cleartarget issue

Posted: Mon Nov 12, 2012 11:06 am
by rock5
I've done that once or twice, putting print messages everywhere because I don't know where the problem is. It's very frustrating and time consuming.

Yeah, so that section looks nothing like that now. There isn't even a while loop there anymore. :S

I'm about to post my new version if you want to check it out.