Page 1 of 1

Permanent mount

Posted: Mon Jul 14, 2014 9:59 pm
by ZZZZZ
Hey, just wondering, how would I check if I have a permanent mount or not? I'm after a function to check for a perm mount before running AT, and if the character doesn't have 1, then collect the mount pieces, otherwise skip them.

At the moment im just maintaining a list of names that do not have 1, but would really like a neater way of doing it.

Re: Permanent mount

Posted: Mon Jul 14, 2014 11:06 pm
by lisa
* has a peak at player:mount() *

Code: Select all

	-- Find mount
	if RoMScript("PartnerFrame_GetPartnerCount(2)") > 0 then
		-- There is a mount in the partner bag.

Re: Permanent mount

Posted: Mon Jul 14, 2014 11:23 pm
by ZZZZZ
Not all char's have mounts in that bag though, I use other players accounts at times and not all of them put perm mounts in the mount bag...

Though I guess there isn't really any other way to check, I tried a little function to read the tooltip but I fail at doing that lol. oh well.

Re: Permanent mount

Posted: Tue Jul 15, 2014 12:29 am
by rock5
I don't know about permanent mounts but you can check if you have a mount, using the way the bot does it, eg.

Code: Select all

if RoMScript("PartnerFrame_GetPartnerCount(2)") > 0 or inventory:getMount() then
    -- player has a mount.
You should be able to get whether it's permanent from memory. I'll have a look.

Ok, looks like an offset of 0x70 from the base address is 1 if the item expires and 0x74 is how many seconds it lasts.

I'll write a little function that answers your particular need.

Code: Select all

function noPermanentMount()
    if RoMScript("PartnerFrame_GetPartnerCount(2)") > 0 then
        return false
    else
        local mount = inventory:getMount()
        if mount and memoryReadInt(getProc(), mount.BaseItemAddress +0x70) == 0 then
            return false
        end
    end
    return true
end
Just add this to your waypoint files onload or make a userfunction file with it. Then in your waypoints you can do

Code: Select all

if noPermanentMount() then
    -- Do whatever you do to make it get the mount pieces
end
Note: This assumes you only have 1 mount. Why would you have a temporary one if you have a permanent?

Re: Permanent mount

Posted: Tue Jul 15, 2014 12:32 am
by ZZZZZ
Awesome! Thanks once again R5, just what I was after :)

Re: Permanent mount

Posted: Tue Jul 15, 2014 12:36 am
by rock5
Maybe I'll add some expiry info to the item class. I'm pretty sure those offsets apply to all items that expire.