House class

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

House class

#1 Post by rock5 » Tue May 20, 2014 1:40 am

I've been working on a house class, on and off, for a while. It's been frustrating me a bit so I feel like venting a bit.

First a bit about what I've done so far. I created a house class with some function. So far the functions include

Code: Select all

house:findItem(name) -- Searches all house storage chests including servant inventories.
house:findEquipedItem(name) -- Searches servant equipped items.
house:itemTotalCount(name) -- Counts how many of an item there are in all the house storages.
Servants are stored in a sub table house.Servants and you can use similar functions on the servants to search only the servants, eg.

Code: Select all

servant = house.Servant[1]
servant:findItem(name)
servant:findEquipedItem(name)
servant:itemTotalCount(name)
Storage devices such as chests are stored in house.Chests and you can use the following functions,

Code: Select all

chest = house.Chests[1]
chest:findItem(name)
chest:itemTotalCount(name)
All the search functions return an item table including the following information

Code: Select all

item.DBID -- This is the container identifier.
item.BagId -- The slot in the container where the item is.
item.Name -- The item name
item.ItemCount -- The stack amount.
This class only uses in game functions so the returned data is limited. Each item has the following functions so far.

Code: Select all

item:pickup() -- Picks up the item
item:draw() -- Moves item directly to your inventory. 
item:delete() -- Deletes the item.
This works without opening any containers. I got most of this done before I realized sometimes it couldn't see what is in the containers without opening them first at least once. So now I'm resigned to the fact that I have to open the chests first before the class functions start working properly. Turns out that's not too easy to do but I finally got it working. Turns out to successfully open the chest the client window needs to be in the foreground, the mouse needs to be over the object and you have to move the mouse a bit over the object first. Then you can do a player:target_NPC("chestname") and it will open correctly. Bit of a pain but now I have another issue. I have no way to tell which object in the house corresponds to which furniture in the furniture drop down list. So if I want to open a chest to populate it's contents, I have no idea which object it is. I've been working on this a couple of days now including memory searches so I don't think I'll find a solution for this. The only idea I can think of is, when the user does a house:update() it goes to every object in the house and tries to open it. Once it's opened all the containers it should be able to use the functions normally. This assumes that all the chests will be accessible from the one location.

That's enough venting. Feel free to comment on your thought about the class.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: House class

#2 Post by BlubBlab » Tue May 20, 2014 1:59 am

You mean you have all those object in the house with it's x,y,z coordinates but no name?
If the you have the name and the name is the same for say 3 chest, you need to add additional information( x,y,z) or you need simple target the nearest.(if you want go through all you need a list)
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: House class

#3 Post by rock5 » Tue May 20, 2014 2:16 am

Yeah, I can't use the name to positively identify the chests because you can have more than 1 of the same chest. So if I have 2 Storage Chests in the furniture list I have to open both "Storage Chests" in the objectlist to find the one I'm after. The furniture in the furniture list doesn't have x,y,z so I can't even use that. I should be able to limit it to only opening the furniture with storage slots by using the names but I'll still have to open all of them.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: House class

#4 Post by BlubBlab » Tue May 20, 2014 3:06 am

The be more clear when you talking about the furniture list do you mean the drop down list in the game or the object list which the bot read?

If your object don't have xyz you could only open it if you know the exact xyz coordinates, if you can read a list of objects which contain names with xyz coordinates target the nearest, in both cases you have to stay exactly in front of of the chest.

If the chests stay to close together this could become an issues.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: House class

#5 Post by rock5 » Tue May 20, 2014 3:35 am

Yes, I mean the dropdown list in the house interface. From that list I get the DBID which I use in most of the in-game house functions to identify the furniture. Targeting a furniture is not difficult. Say I want to open all the "Storage Chest"s. I can just go through the objectlist, ie. CObjectList, and for every "Storage Chest" do something like this

Code: Select all

player:target(obj)
Attack()
So there is no danger of opening the wrong one. The only problem is I can't open a specific chest in the furniture list because there is no way I can tell which is which. If I want to open a particular "Storage Chest", I will have to open all of them.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: House class

#6 Post by BlubBlab » Tue May 20, 2014 8:05 pm

The only thing I can think of is if you open a chest you can properly find out peer ROM-API which is open by going through the furniture list and ask a all the chests in the list which is open /what is the content of the chest.

You can memorize this information in the userfunction but you can't know which is which before you open it.
From the perspective of a normal use it wouldn't be a problem because what I do with a chest is:
1.) Seek something and I don't know where it is so I would go throw all chest.(until I found it)
2.) I want something from a specific chest so I set a waypoint in front of it.

Both ways doing okay with it.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: House class

#7 Post by rock5 » Wed May 21, 2014 1:40 am

BlubBlab wrote:The only thing I can think of is if you open a chest you can properly find out peer ROM-API which is open by going through the furniture list and ask a all the chests in the list which is open /what is the content of the chest.
Except if you have to open the chest first then there is no point in matching it to the furniture list. Once the chests have been opened once they are no longer needed.
BlubBlab wrote:From the perspective of a normal use it wouldn't be a problem because what I do with a chest is:
1.) Seek something and I don't know where it is so I would go throw all chest.(until I found it)
2.) I want something from a specific chest so I set a waypoint in front of it.
I think I will have to add support for doing something like 2. Maybe open the chests in order of distance. I think though when opening a chest of a particular name I will always have to open all of them.

Wait I just remembered. When you open a chests the chest frame includes information about the DBID as well as the Furniture list index. So when I open a chest, at least I can positively match it to the list. That'll help a bit.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

dx876234
Posts: 188
Joined: Sat Jul 24, 2010 6:13 am

Re: House class

#8 Post by dx876234 » Thu May 22, 2014 6:12 am

--delete--

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest