Bee Keeping questions

Name says it all
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: Bee Keeping questions

Post by MagicUser »

Alright, so I went and found my findings txt as well as my potion mapping txt.
Wil wrote:
Wed Mar 01, 2023 6:44 am
[60000] button 58 9 1210 1210 1 0 60000

The 58, 9 look like x/y coordinates within the gump. Are they?
Yes. I believe you are correct.
Wil wrote:
Wed Mar 01, 2023 6:44 am
tilepic 44 10 2538
tilepichue 50 10 2538 844

And then the same here, x, y coordinates (probably top left), a pic number from art.mul (2538=0x9ea, a golden dot with a black border) and an optional UO hue number that you can check in the hue room and translate to either dark (0) or bright (1). Default hue is yellow/gold, so I assume plain tilepic would be a 1.
I have written down 8 unique colors.
Good: 842, 843, 844
Bad: 1501,2007,2107,2108,2109
Wil wrote:
Wed Mar 01, 2023 6:44 am
This is the basket graphic (65=0x41) from gumpart.mul. I assume it's saying to put the basket at position 0,0 (top left) within the defined area for the gump, though perhaps it's saying place a gump based on the basket graphic at screen position 0,0.
Its saying put the basket at 0, 0 relative to the top left corner of the gump. Where that is on screen is a different matter.
Wil wrote:
Wed Mar 01, 2023 6:44 am
Can you take the data you collected and re-inject it to the client via a script so that you can paint your own gump? If yes, then you'd be able to adjust the numbers and see how the gump changes as a result. That'd make it real easy to try out techniques and equations until your script picks the right place to click.
100% yes, in fact this was my plan if I ever decided to do this, since it would be way too tedious to test out on a normal hive. You only get 22 tests per day. The biggest problem is that making gumps in Orion is tedious. You can only really test functionality or use an example, since there is no documentation or tutorials. In this case probably easier, since you can see all of the gump information.
Wil wrote:
Wed Mar 01, 2023 6:44 am
If they are x,y positions then you could just do the opposite of my OpenEUO algorithm: instead of reading and shrinking the bitmap, create your own bitmap, fill it with 1's and then paint a blotch of 0 centered at each 0 hued tile. Then it's the same algorithm I did: find the biggest contiguous 0 spot in the bitmap.
Yeah, so I figured I would use a sparse 2D array. The 2D array would have the corresponding, good or bad color (0 - filled, 1 - not filled). The reason for the sparse, would be to make the columns have the same number of cells. Makes it easier to tell if a cell is neighboring or not without some linked list or other additional complexities. The have a dictionary linking each cell to a button. Use BFS to find the 2 largest groups of 1s. Find the center of the cluster. Click the corresponding button. If it fails, save some information to a log file and wait for the user to click the hive manually.
Wil wrote:
Wed Mar 01, 2023 6:44 am
tilepic 190 71 3850
This is a poison potion with some empty space to either side (art.mul index 3850)

text 190 71 1153 1
should mean gump text index 1 (the number "1") hue 1153 (ice white) at positon 190,71 (poison potions already applied)

text 81 71 52 3
should mean text index 3 (a hyphen "-") hue 52 (yellow) at position 81.71 (infestation, aka needs poison)

text 116 146 92 10
should mean text index 10 ("Thriving") hue 92 (blue) at position 116,146
I never looked into the .muls so this may be a feasible solution. I used the text and command lists.

I believe this was the way that I got the potion counts.

Code: Select all

function getPotionCounts(gump) {
	var textList = gump.CommandList();
	var numList = [];
	
	for (var i = 0; i < textList.length; i++) {
		if (Orion.Contains(textList[i], 'text') && Orion.Contains(textList[i], '190')) {
			var textDetails = textList[i].split(' ');
			numList.push(textDetails[textDetails.length - 2]);
		}
	}
	
	var uniqueList = gump.TextList();
	numList[0] = uniqueList[0];
	
	return numList;
}
Note that the textlist has the first number found uniquely. So the first unique number is always agility. Which removes a lot of mapping.

I have attached the
bee_findings.zip
(1.05 KiB) Downloaded 70 times
with the findings (2 .txts in a zip). The date shows 2021, so this was a long time ago, as I said before. I don't remember a ton about them if people are wondering what the heck they are saying.

If I recall correctly:
beefindings - The visible is the overlaying picture. The counts are how many in a row with the first tiles x, y, and width. The actual is the underlaying button with the same format.

No idea what the number at the bottom is.

Potion mapping - the first column is the actual applied potions and the second part is what the command list shows. I did it manually for a bit and then I started to see some patterns and tried to predict what it would be with certain scenarios.

Probably a little bit of an information dump, but hey. Why not. I figured at least Wil would appreciate it.
Respectfully,
Paroxysmus ILV Master Spellcaster
User avatar
Wil
Legendary Scribe
Posts: 1128
Joined: Mon Dec 30, 2013 1:19 pm
Location: Seattle, WA, USA
Contact:

Re: Bee Keeping questions

Post by Wil »

MagicUser wrote:
Wed Mar 01, 2023 3:01 pm
Wil wrote:
Wed Mar 01, 2023 6:44 am
If they are x,y positions then you could just do the opposite of my OpenEUO algorithm: instead of reading and shrinking the bitmap, create your own bitmap, fill it with 1's and then paint a blotch of 0 centered at each 0 hued tile. Then it's the same algorithm I did: find the biggest contiguous 0 spot in the bitmap.
Yeah, so I figured I would use a sparse 2D array. The 2D array would have the corresponding, good or bad color (0 - filled, 1 - not filled). The reason for the sparse, would be to make the columns have the same number of cells. Makes it easier to tell if a cell is neighboring or not without some linked list or other additional complexities. The have a dictionary linking each cell to a button. Use BFS to find the 2 largest groups of 1s. Find the center of the cluster. Click the corresponding button. If it fails, save some information to a log file and wait for the user to click the hive manually.
As you know, the secret to a good algorithm is picking the right data structure. A sparse data structure will be hard to write an algorithm for. Go the other way: make the 2D array exactly the same size as the gump and fill it with light (1), but where it tells you to place a dark object 2538, change a whole circle of elements in your array to dark (0) instead of just one element. Then you can lift the exact same algorithm I wrote in my script to walk the 0 elements and figure out the biggest spot and its center.

After you have the center, you just have to find the nearest button. Distance between two points is trivial math.
MagicUser wrote:
Wed Mar 01, 2023 3:01 pm
I never looked into the .muls so this may be a feasible solution. I used the text and command lists.
Don't directly care about the muls, look at the positions.

The text at 81,71 is always infestation. If the gump doesn't have text at 81.71 then there is no infestation. If it's hue 52 (yellow) then there is infestation needing 1 poison potion. If it's red, there'll be another hue. If it's present and any other hue besides yellow and red then abort the script and report the unexpected color.

The text at 190,71 is always the number of poison potions already applied. If there's no text at 190.71, abort the script due to the unexpected condition. Otherwise, look up the text at the given index. If the text (not the index) is anything other than 0, 1 or 2 abort the script and complain about the unexpected text. Subtract the number of potions applied from the number of potions needed and that's the number of times to click the poison button.
MagicUser wrote:
Wed Mar 01, 2023 3:01 pm
Probably a little bit of an information dump, but hey. Why not. I figured at least Wil would appreciate it.
I'm hoping that if I'm helpful enough, you'll write the beekeeping script for me giving me, among other things, a nice example to work from for the other scripts I'll need to port if/when I want to use Orion.

BTW, I noticed that Orion seems to have some trouble with house to house teleports. It seems kinda random whether it displays them or displays the house floor. Have you experienced that as well?
MagicUser
Elder Scribe
Posts: 174
Joined: Mon Nov 03, 2014 2:24 pm
Location: PST

Re: Bee Keeping questions

Post by MagicUser »

Wil wrote:
Wed Mar 01, 2023 6:37 pm
As you know, the secret to a good algorithm is picking the right data structure. A sparse data structure will be hard to write an algorithm for. Go the other way: make the 2D array exactly the same size as the gump and fill it with light (1), but where it tells you to place a dark object 2538, change a whole circle of elements in your array to dark (0) instead of just one element. Then you can lift the exact same algorithm I wrote in my script to walk the 0 elements and figure out the biggest spot and its center.
Mmm. I like the idea of thickening the walls. It helps prevents wall collision and holes in walls. We did this a couple times when we were working on a SLAM bot for robotics. As for a sparse array being a difficult structure to make an pathfinding algorithm, a sparse array just means that the array has a lot of the same value. It would be more accurate of me to say that I'd be padding the array for a consistent up, down, left, right being neighbors. If you don't pad the array, you might end up with an 8 index array on top of a 10 index array. Then you'd have to say that the 1st index of the top array is the neighbor of the 0th index of the bottom array. Idk, I obviously haven't implemented it, but I was anticipating the problem of detecting neighbors. If you have a consistent row, column count then perhaps you don't have to worry about what cell is a neighbor or not. And yes you could hard code it, but :(. Hard coding stuff just hurts. Sometimes you have to, but ugh.
Wil wrote:
Wed Mar 01, 2023 6:37 pm
After you have the center, you just have to find the nearest button. Distance between two points is trivial math.
True, distance is definitely not the most complex part of this. Could go Euclidean or Manhattan if time complexity is a problem.
Wil wrote:
Wed Mar 01, 2023 6:37 pm
I'm hoping that if I'm helpful enough, you'll write the beekeeping script for me giving me, among other things, a nice example to work from for the other scripts I'll need to port if/when I want to use Orion.
Hah! Well this kind of project is usually something I only do when I have more than a week of free time. I am not even sure I'll have that during Spring Break. Maybe during summer after work, but we'll see. My mom's been waiting for at least a year for something more than a semi-automatic script. The current script harvests all the honey and wax fully automatically, but the potion application... it only opens the hives up sequentially applies the poison and waits for agility and cure application.

I dropped bees and voting entirely. Its too much of a stress to have to be on every single day during the school term. Sometimes I want to just curl up in bed and read a book away from the world. Sometimes I have 2 hour average sleep a night weeks where I can barely breath let alone eat. I'd rather get on when I want and do whatever I want rather than have another thing I need to fit in my day. Even if it only takes a few mins. This also makes my desire to make such a script almost entirely for the challenge and maybe a little, because my mom would benefit.

Anyway, lets just say... I'll let you know if I get around to it. There are other things that I would be more interested in scripting. I saw the challenge, I looked into the challenge, and I'd say this is pretty much a solved problem. And at least for a while that's enough for me.
Wil wrote:
Wed Mar 01, 2023 6:37 pm
BTW, I noticed that Orion seems to have some trouble with house to house teleports. It seems kinda random whether it displays them or displays the house floor. Have you experienced that as well?
Yes, I have had this before. Very rarely. I had some funky stuff with a castle that I think was on the other side of a chunk boundary of sorts. There was a very clear line across the screen and the castle wouldn't load unless I went back there. If I went through a house gate to it, some of the house tele's inside weren't visible. I bet orion.resend would fix it though. Never had a huge issue with it.
Respectfully,
Paroxysmus ILV Master Spellcaster
Alibaster
Legendary Scribe
Posts: 211
Joined: Wed Nov 16, 2016 11:02 am

Re: Bee Keeping questions

Post by Alibaster »

MagicUser wrote:
Thu Mar 02, 2023 12:02 am

Anyway, lets just say... I'll let you know if I get around to it. There are other things that I would be more interested in scripting. I saw the challenge, I looked into the challenge, and I'd say this is pretty much a solved problem. And at least for a while that's enough for me.
Everything you guys said is a foreign language to me. However, I did understand the quote above. If you ever decide to actually make this thing, please let me know. I think this script would be just as valuable as the Balron script and I would be happy to pay you gold for it. :D Plus making you mom happy is priceless. :wink:
Alibaster in game!!
User avatar
ButteryBiscuits
Elder Scribe
Posts: 112
Joined: Tue Apr 30, 2019 9:32 am

Re: Bee Keeping questions

Post by ButteryBiscuits »

Alibaster wrote:
Thu Mar 02, 2023 12:40 am
s making you mom happy is priceless. :wink:
Wisdom from the forums :nod:

Reading happy things and seeing players discuss in-game stuff respectfully and building each other up is so nice. Can we vote for more forum threads like this?

Image
Attachments
HappyPikachu.jpg
HappyPikachu.jpg (158.42 KiB) Viewed 1121 times
BB
---------------------------
ButteryBiscuits
in game name ButteryBiscuits
https://en.wikipedia.org/wiki/Mermaid_of_Warsaw
Post Reply