Page 5 of 9

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 8:48 am
by vietales
lisa wrote:line 261 has this

Code: Select all

item = inventory.BagSlot[slot]
change to this

Code: Select all

item = self.BagSlot[slot]
still got this

Code: Select all

8:47pm - ...ce/micromacro_work/scripts/rom/classes/inventory.lua:262: attempt to index global 'item' (a nil value)

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 9:49 am
by lisa
tested this and it works for me, if you get any errors then the issue is elsewhere.

Code: Select all

	<!-- #  1 --><waypoint x="-5489" z="3326">	</waypoint>
	<!-- #  2 --><waypoint x="-5489" z="3326">if(60 > inventory:itemTotalCount(0)) then
printf("it works omg\n")
end	</waypoint>
	<!-- #  3 --><waypoint x="-5489" z="3326">	</waypoint>
	<!-- #  4 --><waypoint x="-5489" z="3326">	</waypoint>
	<!-- #  5 --><waypoint x="-5489" z="3326">if(60 > inventory:itemTotalCount(0)) then
printf("it works omg\n")
end	</waypoint>
	<!-- #  6 --><waypoint x="-5489" z="3326">	</waypoint>

Code: Select all

Mapping inventory (bagslot 1 to 60)...
100% [**************************************************]
Moving to waypoint #1, (-5489, 3326)
Moving to waypoint #2, (-5489, 3326)
Mapping inventory (bagslot 1 to 60)...
100% [**************************************************]
it works omg
Moving to waypoint #3, (-5489, 3326)
Moving to waypoint #4, (-5489, 3326)
Moving to waypoint #5, (-5489, 3326)
Mapping inventory (bagslot 1 to 60)...
100% [**************************************************]
it works omg
Moving to waypoint #6, (-5489, 3326)
Moving to waypoint #1, (-5489, 3326)
Moving to waypoint #2, (-5489, 3326)
Mapping inventory (bagslot 1 to 60)...
100% [**************************************************]
it works omg
Moving to waypoint #3, (-5489, 3326)
Moving to waypoint #4, (-5489, 3326)
Moving to waypoint #5, (-5489, 3326)
Mapping inventory (bagslot 1 to 60)...

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 10:25 am
by vietales
rock5 wrote:In 477 itemTotalCount is not capable of counting empty slots. I added that functionallity in a later version. It should be easy enough for lisa to add it for you guys. Just cut and paste.
lisa wrote:tested this and it works for me, if you get any errors then the issue is elsewhere.
Does the new 'inventory.lua' that lisa has just uploaded contain the function to count empty slots?

For me, this command always return 0

Code: Select all

cprintf(cli.white, "Bag Space:             	%s\n", inventory:itemTotalCount(0))

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 10:46 am
by rock5
It looks like it should count the empties but I think there are going to be problems if only 1 file is updated. inventory.lua uses item.lua extensively so I think at least item.lua should have been included in the update. Of particular concern is the 477 version of item.lua uses 1 as the first bag slot number instead of 61. I'm not sure what effect that will have.

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 11:07 am
by lisa
yeah sorry my fault, been focusing on trying to get through the last few addresses and haven't been spending the time that doing this properly would require.

I think the absence of
addresses.inventoryBagIds
and
addresses.staticInventory
is going to make it very difficult to achieve this.

Unless you did a romscript to see if there is an item in the bag slots.
So literally 30 romscripts per bag. Not something you would want to be doing a lot.

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 11:47 am
by lisa
Alrighty this should keep you going atleast


a few ways it can be used, 1 is to literally check if you have no free space at all in your bags, this would require checking every slot in your bags, very time consuming.

You can however assume that the bag fills from slot 1 and continues in order.

So if you have 2 bags then you can set the check for just the last 5 slots of bag 2 with this
checkbagspace(56,60)
usage would be in your WP

Code: Select all

if 1 >= checkbagspace(56,60) then 
-- what ever code you want if bags r full
end
It's a userfunction so add it to the user function folder.

Code: Select all

function checkbagspace(_start,_finish)
_space = _finish - _start + 1
for i = _start, _finish do 
local check = "GetBagItemInfo("..i..")"
local inventoryIndex, icon, name, itemCount, locked, invalid = sendMacro(check)
if itemCount ~= 0 then _space = _space - 1 end
end
return _space
end
Of course if you get items in those last 5 slots that you don't want sold by autosell then they stay there and bot will always return those bags being full. But checking 5 slots and if just 1 is empty is farely safe, if not then check 10.


This code is tested and works well.

You can check item slot numbers at the bottom of this page, there are pix
http://www.theromwiki.com/API:GetBagItemInfo

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 7:27 pm
by rock5
Maybe you could do a sort before checking for empties. Then all your empties will move to the end.

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 10:41 pm
by lisa
As an update I have rev 605 working on the old client, only trouble is the inventory isn't working atm, either I have an address wrong or an offset wrong.
So it doesn't detect what items are in the bags or any other info from bags.

my guess is the inventoryBagIds is wrong.

Re: 3.0.4 client servers, Revision 477

Posted: Sun Jun 12, 2011 11:49 pm
by harbifm
fantastic news, if that is fixed, we could jump into rev 605 without any problems :D

thanks for the great work lisa

hope you get this issue of consuming itmes (useGoodie) and auto sell working with the new inventory.lua

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 1:10 am
by vietales
lisa wrote:Alrighty this should keep you going atleast
Awsome, it is working now
Thanks Lisa

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 5:28 am
by rock5
lisa wrote:only trouble is the inventory isn't working atm, either I have an address wrong or an offset wrong.
Let me see, how would i look for the staticinventory address?

This line

Code: Select all

		self.Address = addresses.staticInventory + ( ( self.BagId - 61 ) * 68 );
tells us that if the bagid is 61 then the item address will equal the staticinventory address. So first you need to find which slotnumber has bagid 61.

Code: Select all

/script for i = 1,60 do if GetBagItemInfo(i)==61 then SendSystemChat(i) end end
In my case it printed 5.
Then I'd put something in the 5th slot and do a search for one if its attributes that is offset from the items address, eg. itemcount, durability. Item count would be easy. So I put a stack of 37 Foloin Nut in slot 5 and do a search for "37" using Cheat Engine.
Then I keep changing the count and doing searches until I find the address.
I found the green static address of 009CACA8.
The itemcount offset is 0x10. So the address of item with bagid 61 is 0x9CAC98 which makes staticInventory = 0x9CAC98. Checking the addresses.lua I see it's right. :)

Hope that helps.

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 6:23 am
by lisa
Ahh that would make more sence, I was going through mapping each slot and going to use the lowest address and adjusting with offset. Your way is much easier lol

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 9:33 am
by lisa
Ok I think I am down to my last hurdle, i hope lol
inventoryBagIds = 0x9C3B30, in client 3.11
From what I can tell so far it is how the bot tells which bag slot is in the bagid, because the bags are done randomly so slot61 isn't always in first spot of bag 1.

I have no idea how to detect that though.

I know slot 6 of bag 1 is actually bagslot 61, currently
I know slot 24 of bag 1 is actually bagslot 62. currently

I can't think of any way to do this because any searches I do in CE for items in the bags is the same process I did for the staticinventory, so I can't see ot returning anything but the address for the bagslot.

Item shop bag is working fine.
Durability 0
ItemCount 6
Color 4289225896
ObjType 11
InUse false
SlotNumber 50
Value 0
Empty false
Icon
Quality 8
CoolDownTime 0
BagId 50
BaseItemAddress 371979520
Id 202435
RequiredLvl 1
ObjSubType -1
ObjSubSubType -1
BoundStatus 32
ItemLink |Hitem:31
Name Home-sweet-home
Address 10238020
MaxStack 100
Worth 0
Available true
LastTimeUsed 0

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 10:13 am
by rock5
What this means,

Code: Select all

self.BagId = memoryReadUByte(proc, addresses.inventoryBagIds + self.SlotNumber - 1) + 1
is that somewhere in memory there is a list of bagids in order of slotnumber, eg
62
65
64
63
61
etc.

So what you need to do is get the first 4 bagids to search for them together.

Code: Select all

/script SendSystemChat(GetBagItemInfo(1)..GetBagItemInfo(2)..GetBagItemInfo(3)..GetBagItemInfo(4))
I got 74 80 78 77.
Convert to hex. 4A 50 4E 4D.
Minus 1 from each. 49 4F 4D 4C.
Reverse them 4C 4D 4F 49.
Then do a 4 byte hex search for 4C4D4F49.
I only got 1 result and it was the right one. The address it finds is the inventoryBagIds address.

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 10:44 am
by lisa
Hmm whats ur addresses.lua show for inventoryBagIds, mine is
inventoryBagIds = 0x9D18FC,
When I go to that address on my current client it has
00 00 00 00 00 00 00 00 00 00 00 00 04 00 20 00

A few lines down though there is this
41 40 3C 3F 3D 3E 42 43 44 45 46 47 48 49 4A 4B

my result from the code was
66 65 61 64
42 41 3D 40
41 40 3C 3F
so without the reversal it would be that address of 0x9D1938 and not 0x9D18FC

I tried the reversal and got "no found"

I changed the display and it reversed the bytes, so all good. either way this means my inventoryBagIds is wrong for current client

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 11:19 am
by rock5
Sorry, yes, I got 9D1938 as well. I actually already had that address in the bottom address list in CE and it was that address. I didn't realise that the one in addresses.lua was different.

Well it's easy to solve. The difference between them is 60 and if you look at this line,

Code: Select all

self.BagId = memoryReadUByte(proc, addresses.inventoryBagIds + self.SlotNumber - 1) + 1
You'll see that it adds 60 to the address for the first slot therefore we have to minus 60 to get the address we want.

Sorry I missed that.

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 11:26 am
by lisa
OMG cheeers from the gallery. lol

Ok need to test this a bit first but it looks like I have finally got all the addresses.

Thanks rock

Lol you would never believe it, first recipe drops it errors for the same reason current client errors. How weird, has to be an issue with the bot coding then.
I just did the same -- comment out the card and recipe section, running smoothly again now.

Bah forgot all about
chatbase_address = 0xA943AC,
I figure I could leave it til last, then forgot it lol
A tomorrow project, tired now

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 7:58 pm
by lisa
Well it ran pretty well on millers overnight, testing some other features to make sure I got the addresses right, things like pet and such. I only made 1 account so can't test party bot, not going to make another account. If people post it doesn't work then I will look into it.

Code: Select all

Displaying Stats:
Egg Stats:
Per 100 fresh eggs.
        To Collect      To Deliver      Golden Eggs Dropped
        71m             58s             5
        75m             60s             6
        76m             58s             4
        74m             58s             7
        77m             58s             9
Fresh Eggs average drop rate: 79.78 per hour
Golden Eggs average drop rate: 4.94 per hour

Total stuck hens = 1

Total stuck eggs = 1

Re: 3.0.4 client servers, Revision 477

Posted: Mon Jun 13, 2011 9:11 pm
by lisa
Update,

ToDo
--autosell isn't selling anything, no errors either just doesn't sell.
--rentbag address is off, it is only using half of bag 3.
--Test GMdetect, can't msg myself so can't test that part, just 1 account. Also haven't even seen or heard 1 GM so no idea if current detection will work for the diff language.

Working/tested
--All aspects of fighting including buffs, I don't use the function use goodie but I coded into onleave combat to check buffs and use house pots if required.
--pet system, both crafting and assist including feeding.
--harvesting
--loot and lootall
--millers egg farming (I didn't try milk)

Re: 3.0.4 client servers, Revision 477

Posted: Tue Jun 14, 2011 4:55 am
by harbifm
are you wokring on rev 605?

did you try the usegoodie function? if it is not using working, can u post ur code for using house food and luck potion?


are all miller egg ranch codes workings? which ones (I am currenly using 1.3 with 3 egg/hour rate), did test the ones that have the addons (maybe the are faster)?

did you test the catchCavy() fucntion ?