Page 2 of 3

Re: Extracting 'scores'

Posted: Thu Feb 27, 2014 1:39 am
by rock5
As far as I know, profile options do get changed to their respective types. Numbers are converted to numbers, booleans get converted to boolean. Unless maybe you used capitals, eg. "False". That might not get converted.

Re: Extracting 'scores'

Posted: Thu Feb 27, 2014 2:18 am
by lisa
for some reason my healer profiles all had it set to true, that's what I get for copy pasting 1 file to many for many healers lmao.

Set to "false" and it should be fine.

Re: Extracting 'scores'

Posted: Thu Feb 27, 2014 7:25 am
by ZZZZZ
Well after messing around with things for a while it finally works..... Not sure what I changed to make it stop failing when targeting the mobs lol. As for the distance check I had to add in a seconds check to make sure it was different, because for some reason it would 'pass' the first check but still be false.....

Code: Select all

	function KillMobs()
		yrest(10)
		player:update()
		if player:findEnemy(nil,nil,evalTargetDefault) then
			enemy = player:findEnemy(nil,nil,evalTargetDefault)
			printf(""..enemy.Name.."");
			if enemy.Name == "Hlethfir Deliriumscribe" or enemy.Name == "Kaleks Nightmareclaw" or enemy.Name == "Herugrim Dreamlava" or enemy.Name == "Mayvel Nightmaremuse" or enemy.Name == "Nightmare Beast Atollop" then
				useGoodie("critp");
				RogueBoss(true);
				printf("Boss settings updated");
			end
			while enemy do
				player:target(enemy)
				player:fight()
				enemy = player:findEnemy(nil,nil,evalTargetDefault)
			end
			RogueBoss();
		end
		player:updateBattling()
		if (not player.Battling) then
			if player:findEnemy(nil, nil, evalTargetLootable) then
				local Lootable = player:findEnemy(nil, nil, evalTargetLootable)
				while Lootable do
					player:target(Lootable)
					if player.TargetPtr ~= 0 then
						player:lootAll()
					end
					Lootable = player:findEnemy(nil, nil, evalTargetLootable)
				end
			end
		else
			KillMobs();
		end
		prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
		repeat
			yrest(2000);
			printf("Waiting for next area to appear")
			player:update();
		until distance(player,prevcoords) >= 100 or (not isInGame())
		yrest(3000);
		cprintf(cli.yellow,"\nArea changed\n")
		player:update()
		if isInGame() and distance(player,prevcoords) >= 200 then
			DLApplyPots()
			yrest(2000);
			__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
		elseif not distance(player,prevcoords) >= 200 then
			player:update();
			yrest(1000);
			DLApplyPots()
			__WPL:setWaypointIndex(__WPL:getNearestWaypoint(player.X,player.Z,player.Y))
		end
	end
Now im just down to figuring out how to make PartyHeals() load my waypoint that resets Dreamland and it'll be sweet.

And also

Code: Select all

		function settings.profile.events.onSkillCast(arg1)					-- add ID = 104924	
			local target = player:getTarget()
			if target.Name == "Hlethfir Deliriumscribe" then
				local ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
				if ghostadd and target.Id ~= 104924 then
					player:breakFight()
					while ghostadd do
						player:target(ghostadd)
						player:fight()
						ghostadd = player:findEnemy(nil, 104924, evalTargetDefault);
					end
				end
				player:target(target)
			end
		end
Works perfectly for targeting and killing the adds as soon as they spawn :D

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 1:15 am
by ZZZZZ
After running it for a number of hours, I have found only 1 issue with the kill/loot function and that's to do with 'skipping' a lootable target. The code I have is

Code: Select all

if (not player.Battling) then
			if player:findEnemy(nil, nil, evalTargetLootable) then
				local canLoot = player:findEnemy(nil, nil, evalTargetLootable)
				repeat
					player:target(canLoot)
					player:loot(canLoot)
					player:lootAll();
					player:update();
					local canLoot = player:findEnemy(nil, nil, evalTargetLootable)
				until not player:findEnemy(nil, nil, evalTargetLootable)
			end
		end
Every now and then it'll leave 1 or more Lootable targets around and sit there waiting for next area to appear. I'm not sure why it would skip a target, I set Loot-debug to true but no error messages come up.
Does the MM loot function 'tag' something so it doesnt keep looting it if it fails? Say you get a slight increase in ping and looting failed, would that put it on a loot ignore list?

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 1:47 am
by lisa
there is a distance check.

settings.profile.options.LOOT_DISTANCE

you might need to increase it.

and there is also an ignore list if it fails to loot.

there is also a

settings.profile.options.LOOT_IGNORE_LIST_SIZE

you could play around with both values and see if it helps.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 1:55 am
by ZZZZZ
Hmm, interesting. I already have changeProfileOption("LOOT_DISTANCE", 500) in the onLoad to make sure the entire area is looted, but didn't know about the settings.profile.options.LOOT_IGNORE_LIST_SIZE setting. I'll set it to 0 and will run it for a while to see if that solves it, thanks.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 2:21 am
by ZZZZZ
After using ' changeProfileOption("LOOT_IGNORE_LIST_SIZE", 0) ' in the onLoad it still missed a lootable target. The mob is within 50 range of me, so it is definitely not the distance to target, this is what the MM window showed at the time.

Code: Select all

Main hand durability:97.150943396226
We didn't move to the loot!? Root buff? Missing 'click to move' option?
We didn't move to the loot!? Root buff? Missing 'click to move' option?
Clearing target.
Waiting for next area to appear
~~ same issue again:

Code: Select all

Main hand durability:96.207547169811
We didn't move to the loot!? Root buff? Missing 'click to move' option?
Clearing target.
Waiting for next area to appear
So some how it is still adding the mob to the ignore list?

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 5:04 am
by rock5
ZZZZZ wrote:We didn't move to the loot!? Root buff? Missing 'click to move' option?
This means it tried to loot but failed. So it's not the ignore list.

The first thing to check is the suggested causes. Does the mob stun or root you? Do you have "click to move" enabled in the game interface settings? I suspect the second is true or else you wouldn't be looting at all.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 5:17 am
by ZZZZZ
There are some roots, but none of them are around when it does loot. Click to move is on, yes. I have seen it fail loot once myself, it seemed to try to loot after looting another but failed for some reason so just gave up. But then I had the issue again on 1 of the bosses, which is only a single target, so it couldn't be due to looting another at the same time or too close together.

As for not being the ignore list, why would it not keep trying to loot then? Its set to repeat until there are no Lootable targets, and I don't believe the address of the Lootable target would change all because it failed to loot. To me it just seems a lot like it's adding it to an ignore and skipping that specific target.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 6:02 am
by rock5
Everything looks ok. The main Attack() that starts the loot is clear of any new code I've added recently so should always execute. If it fails the second chance loot should work, as long as you haven't disabled it. Are you using any other profile loot options? That's any options that start with LOOT?
ZZZZZ wrote:There are some roots, but none of them are around when it does loot.
I'm not sure you understood what I mean. By root I mean the mob might have caste a debuff that roots you to the spot just before you kill it. Then you wont be able to loot until the debuff wares off.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 6:35 am
by ZZZZZ
Yeh I know what you ment, and what I ment was while some mobs do cast skills that root you none of them are ever around when you finish killing off the adds/boss.

The loot settings in profile are:

Code: Select all

<!-- Loot settings -->
		<option name="LOOT"               	value="false" />
		<option name="LOOT_ALL"			  	value="false" />  		<!-- Loot all nearby dead mobs after combat -->
		<option name="LOOT_IN_COMBAT"     	value="false" />
		<option name="LOOT_DISTANCE"      	value="200" />
		<option name="LOOT_PAUSE_AFTER"   	value="0" />			<!-- probability in % for a short rest -->
		<option name="LOOT_SIGILS"			value="false" />				<!-- Loot sigils or not. If ommitted, will depend on "LOOT" value -->
		<option name="SIGILS_IGNORE_LIST"	value="" />				<!-- List of any sigils you wish to ignore, in language of client -->
		<option name="LOOT_JUMPING"			value="false" />		<!-- Jumps while looting to avoid crouching -->
		<option name="LOOT_AGAIN"			value="2000" />			<!-- Second chance try if first loot failed. -->
		<option name="LOOT_TIME"			value="1500" />			<!-- Amount of time allowed for looting. -->
And the onload of the waypoint:

Code: Select all

	changeProfileOption("LOOT_ALL", true)
	changeProfileOption("LOOT", true)
	changeProfileOption("ANTI_KS", false)
	changeProfileOption("PARTY", true)
	changeProfileOption("PARTY_INSTANCE", true)
	changeProfileOption("MAX_TARGET_DIST", 500)
	changeProfileOption("USE_PHIRIUS_POTION", true)
	changeProfileOption("LOOT_JUMPING", true)
	changeProfileOption("LOOT_AGAIN", 0)
	changeProfileOption("LOOT_TIME", 0)
	changeProfileOption("LOOT_DISTANCE", 500)
	changeProfileOption("INV_AUTOSELL_ENABLE", false)
	changeProfileOption("LOOT_IGNORE_LIST_SIZE", 0)
*note - I only added in the LOOT_JUMPING/AGAIN/TIME settings recently. It still had this issue before I added them.

Re: Extracting 'scores'

Posted: Sat Mar 01, 2014 7:26 am
by rock5
With the LOOT_JUMPING/AGAIN/TIME settings you are using it's possible it might sometimes fail. Those settings are for speed not reliability. But you say you were getting the problem before using these settings. So that means it looks like it was using the default values for LOOT_TIME and LOOT_AGAIN.

I'm not sure what to suggest. If you want to make sure that you loot the boss you could add some code after fighting it to make sure it looted, eg.

Code: Select all

local boss = player:findNearestNameOrId("Boss name",nil,evalTargetLootable)
if boss then
    player:target(boss)
    repeat
        Attack()
        yrest(1000)
        player:updateBattling()
    until player.Battling or not boss:exists() or not evalTargetLootable(boss.Address)
end
Um... something like that.

Re: Extracting 'scores'

Posted: Mon Mar 03, 2014 7:05 am
by ZZZZZ
Ok just found out something. I was trying to use what you posted Rock and for some reason it wasnt simply attacking..so I added prints to different area's and its actually Looting strait after it leaves combat, ignoring what i have in the function until looting is finished.

Code: Select all

Fight finished. Killed 4 Dream Energy Stinger. (fight #10 / runtime 1 minutes)
Main hand durability:99.047169811321
We didn't move to the loot!? Root buff? Missing 'click to move' option?
Not Battling
Inventory cleaned out
Waiting for next area to appear

Code: Select all

if (not player.Battling) then
			print("Not Battling");
			if player:findEnemy(nil, nil, evalTargetLootable) then
				print("Found Lootable")
				local canLoot = player:findEnemy(nil, nil, evalTargetLootable)
				while canLoot do
					player:target(canLoot)
					repeat
						Attack()
						print("Attacking to loot")
						player:updateBattling()
					until not canLoot:exists()
					local canLoot = player:findEnemy(nil, nil, evalTargetLootable)
				end
			end
		end
      clearSlots() -- returns 'Inventory cleaned out' upon completion
		prevcoords = {X=player.X, Z=player.Z, Y=player.Y}
		print("Waiting for next area to appear")
It seems that player:findEnemy(nil, nil, evalTargetLootable) is returning false, even though there is a mob sitting there and not looted. Im not even sure if (nil, nil, evalTargetLootable) is the correct way to write that function ^.^

Re: Extracting 'scores'

Posted: Mon Mar 03, 2014 8:17 am
by rock5
findEnemy is not reliable for finding lootable bodies because the purchase of findEnemy is to find an enemy to attack. So there are check in there that might return false because the target is dead. Try using findNearestNameOrId.

Code: Select all

if player:findNearestNameOrId("", nil, evalTargetLootable) then

Re: Extracting 'scores'

Posted: Mon Mar 03, 2014 4:11 pm
by ZZZZZ
Even after changing it to player:findNearestNameOrId("", nil, evalTargetLootable) it still ignores it :/ This is annoying >.>

Code: Select all

Main hand durability:96.216981132075
We didn't move to the loot!? Root buff? Missing 'click to move' option?
Clearing target.
Inventory cleaned out
Waiting for next area to appear

Code: Select all

player:updateBattling()
		if (not player.Battling) then
          print("Checking for Loot")
			if player:findNearestNameOrId("", nil, evalTargetLootable) then
				print("Found Lootable")
				local canLoot = player:findNearestNameOrId("", nil, evalTargetLootable)
				while canLoot do
					player:target(canLoot)
						player:target(canLoot)
						player:lootAll();
						--Attack()
					local canLoot = player:findNearestNameOrId("", nil, evalTargetLootable)
				end
			end
		end

When reloading the waypoint and running that function again with the same mob there I got this instead:

Code: Select all

Moving to waypoint #7, (2778, 950)
Checking for Loot
Found Lootable
We didn't move to the loot!? Root buff? Missing 'click to move' option?
The game client did not crash.
anddd crashed as soon as trying to loot for some reason....has happened twice now..not sure what is with that either :/

Re: Extracting 'scores'

Posted: Mon Mar 03, 2014 8:56 pm
by rock5
Where are you putting the function? It should be in onleavecombat.

If you want to target something you found manually and want to loot it use player:loot(). player:lootAll() finds it's own targets to loot.

If looting is important then make sure not to use the jumping feature and reset the LOOT_AGAIN and LOOT_TIME to default.

Try adding DEBUG_LOOT to your profile. It might give you some info.

In the end it might be something in evalTargetLootable failing so you could try bypassing that function and doing something like this

Code: Select all

if (not player.Battling) then
    local boss = player:findNearestNameOrId("BossName")
    if boss then
        boss = CPawn(boss.Address)
        while boss:exists() and boss.Lootable do
            player:target(boss)
            player:loot()
            yrest(500)
            boss:update()
        end
    end
end

Re: Extracting 'scores'

Posted: Tue Mar 04, 2014 4:15 am
by ZZZZZ
I tried doing it that way Rock, but I can't figure out how to check all targets in range that way. With

Code: Select all

local canLoot = player:findNearestNameOrId("")
				repeat
					canLoot = CPawn(canLoot.Address)
					if canLoot:exists() and canLoot.Lootable and canLoot.Type == PT_MONSTER then
						print("Looting "..canLoot.Name.."");
						while canLoot:exists() and canLoot.Lootable and canLoot.Type == PT_MONSTER do
							player:target(canLoot)
							player:loot(canLoot)
							--Attack()
							yrest(500)
							canLoot:update()
						end
						local canLoot = player:findNearestNameOrId("")
					end
				until not canLoot:exists() or canLoot.Lootable
it seems to work, but it will only check the nearest (of course) and will not continue checking all in range.

Looking through the looten function, does this part

Code: Select all

				-- Add to ignore list
				lootIgnoreListPos = lootIgnoreListPos + 1
				if lootIgnoreListPos > settings.profile.options.LOOT_IGNORE_LIST_SIZE then lootIgnoreListPos = 1 end
				lootIgnoreList[lootIgnoreListPos] = target.Address
mean that it'll always be adding 1 mob to the ignore list no matter what LOOT_IGNORE_LIST_SIZE is set to?

Re: Extracting 'scores'

Posted: Tue Mar 04, 2014 5:16 am
by rock5
ZZZZZ wrote:mean that it'll always be adding 1 mob to the ignore list no matter what LOOT_IGNORE_LIST_SIZE is set to?
That's correct.

You could try resetting the list before using your code. Example,

Code: Select all

lootIgnoreList[1] = 0

Re: Extracting 'scores'

Posted: Tue Mar 04, 2014 9:06 am
by ZZZZZ
can't log in at the moment to see if it'll work, but 'lootIgnoreList' is a local table within the player.lua file. Is it possible to edit that outside of the file or would I have to change it to global?

Re: Extracting 'scores'

Posted: Tue Mar 04, 2014 9:25 am
by rock5
You're right. Hm... what else could you do? Nothing comes to mind. Try making it global.