SRL Archive - OSR Help

Need help with the Grid System


bud_wis_er_420

2013-02-15 21:28:17

Fist I'm wanting to know if anyone knows of a detailed tut on the Grid System and MMToMS?

What I'm trying to do is, first find multiple points on the MS using a standard colorTPA finding function. The points it finds, I want to transfer to the middle of each grid box it's found in. How accurate are the grid boxes in accordance with the landscape grid. For example lets say I'm standing at point, and I want to click the middle of the landscape square exactly 4 squares over to my right. Can I do this and it will click the exact spot every time.

I'm basically wanting to build a grid on the rs main screen , then search for fishing spots and put each spot it finds into a single grid box. I can then tell it to move the mouse to the middle of each grid box it found a fishing spot in and check it's uptext, etc.

Any help with learning the use of the grid system would be greatly appreciated. I do believe I know the Grid system was made for comparing MM objects to the main screen, but can it also be used to separate the actual runescape floor tiles accurately?

King

2013-02-15 21:30:48

I'd be interested on a Tut for this as well :P I believe we are waiting on a update for MMToMS right?

bud_wis_er_420

2013-02-15 21:34:12

From: SRLKing
I'd be interested on a Tut for this as well :P I believe we are waiting on a update for MMToMS right?


I've read some posts it works fine and others saying it's bugged so I'm not sure. But what I'm trying to do will pull nothing from the MM. I will just build a grid in accordance with the actual runescape floor tiles. Using the MM and/or the compass to get it's bearing.(Facing true north or east, etc.)

Le Jingle

2013-02-15 21:58:51

You won't get accurate tiles with just color unless you implement something to find the screen angle (don't confuse with compass angle). Nonetheless, MMToMS is still fairly accurate when implemented correctly and probably results in a max of approx. 1 tile off the one you want, so pretty decent still at worst.

bud_wis_er_420

2013-02-15 22:43:42

How would I build a grid like this then? I used paint to do this. I have no idea how, lol. I'm not asking to do it for me but I don't even know were to begin. And the boxes would move in accordance to my angle. So at a 45 degree angle The boxes would be diamonds instead. I figured it could use the color of the pier to set the outline of the grid. For example we know the pier to be:


 
// pier
box - box - box - box - box - box
box - box - box - box - box - box
box - box
box - box
box - box - box - box - box - box - box - box
box - box - box - box - box - box - box - box


Would it be something like finding a DTM? but instead of points it looks for the boxes. And in the boxes it looks for maybe so many pixels to match for it to be confirmed as an actual part of the pier.

Le Jingle

2013-02-15 23:02:47

Well, in color, you'd be preforming a lot more (in my opinion) actions than need be. If you use ACA and grab some nice col's for the fish spots, you could combine those with some strong object finding/filtering functions, in turn accomplishing what you want at a fraction of the work. What would be the purpose of boxing the immediate dock and the first tile away from each dock tile?

Olly

2013-02-15 23:09:48

you would never get good tiles, the rs screen rotates/zooms alot more than you think

bud_wis_er_420

2013-02-15 23:26:13

From: Le Jingle
Well, in color, you'd be preforming a lot more (in my opinion) actions than need be. If you use ACA and grab some nice col's for the fish spots, you could combine those with some strong object finding/filtering functions, in turn accomplishing what you want at a fraction of the work. What would be the purpose of boxing the immediate dock and the first tile away from each dock tile?


Already doing this, Was trying to make things more accurate.

From: Ollybest
you would never get good tiles, the rs screen rotates/zooms alot more than you think


What if we made the tiles adjustable. Like with a range limit. For example, just look at the first row there are 6 boxes. I don't know the actual pixel length of each box but lets say it around 50, with a plus/minus of 5. So each box it approximately 50 by 50 pixels but can be a bit smaller or bigger depending on the zoom. The rotation shouldn't matter. Thats the point of the function. The boxes would follow the rotation. Like the pic below.

Anyways the boxes are 50 X 50 with a range or 5. So if I find, 6 boxes in a row or one solid strip(like using find color area) around the range of
6 * 50 = 300 pixes
+/- 5 * 6 = 30
total 270 - 330. if found it ould get the width of found strip of collor, lets say it came out as 312. We would divide this by 6 to get the actual box size.

Now you do this for all row just like finding a DTM. If all boxes match we can use this info to build a grid

the pier is a fixed structure. It should be easy to build a grid around it. I'm just learning how to even print a grid let alone alining one up to color pts.


Le Jingle

2013-02-16 00:32:42

it's not as simple as adding a range to the box sizes… It's more a case of knowing the camera depth, camera angle, and the easy part of compass direction (found easily via the compass). Without accurate functionality with all three of those components, you won't be able to achieve near accurate (more so generalized approximates via MMToMs) results. I iterate again, however, to create an object function to detect desired MainScreen objects. Unless you're trying to pick up items from the floor, or find nearby npc's/players, or looking for MMToMS specific search related influential objects, I'd avoid trying to implement MMToMS as it won't generate as much as a tile system would in other bot clients.

Edit, Also, to help point you into my intended direction as described earlier about object finding, I'd suggest looking into some of Runaway's old object search functions, or perhaps looking through popular scripts (I think superuser has a quality object finding method in his miner), and learning from what those have to offer. There are also nifty scripts that detect fish spots (perhaps @Flight; might be able to offer insight too :] ), so learning from what these other scripts look for, and breaking down what logic resides behind the code for object finding, can result in desired precision object finding such as detecting fish spots.

Pardoning myself, I indeed wish you success, granted I'm still somewhat hazy on what you're trying to accomplish aside from charting the RS main screen into boxes.
Also, I'd still love to help in any way I can granted your further request.

Ciao,
Lj

bud_wis_er_420

2013-02-16 00:49:44

From: Le Jingle
it's not as simple as adding a range to the box sizes… It's more a case of knowing the camera depth, camera angle, and the easy part of compass direction (found easily via the compass). Without accurate functionality with all three of those components, you won't be able to achieve near accurate (more so generalized approximates via MMToMs) results. I iterate again, however, to create an object function to detect desired MainScreen objects. Unless you're trying to pick up items from the floor, or find nearby npc's/players, or looking for MMToMS specific search related influential objects, I'd avoid trying to implement MMToMS as it won't generate as much as a tile system would in other bot clients.

Edit, Also, to help point you into my intended direction as described earlier about object finding, I'd suggest looking into some of Runaway's old object search functions, or perhaps looking through popular scripts (I think superuser has a quality object finding method in his miner), and learning from what those have to offer. There are also nifty scripts that detect fish spots (perhaps @Flight; might be able to offer insight too :] ), so learning from what these other scripts look for, and breaking down what logic resides behind the code for object finding, can result in desired precision object finding such as detecting fish spots.

Pardoning myself, I indeed wish you success, granted I'm still somewhat hazy on what you're trying to accomplish aside from charting the RS main screen into boxes.
Also, I'd still love to help in any way I can granted your further request.

Ciao,
Lj


Thx for the info. But that's it I was just experimenting. Seeing if it was at all possible to chart, as you say, the rs screen using something large and easily defined against the area around it. Like the pier I used as an example with brown colors and the water that surrounds it as blue. I thought it would be an easy thing to build a grid on it and be able to tell exactly what tile I'm on on the rs screen.

I'll get a pic of something I saw similar in another script. Gimme just a sec…

This is from the PreemptibleRuneSpan.4.1.43 script it outlines the borader of the island on the MM. I'm trying to do kinda the same thing but with bigger boxes and on the Main screen.

bud_wis_er_420

2013-02-16 15:59:28

I still wondering if this is possible?

Also I have another question.

How would I search in a TBox area for colors but I want to disregard TP's within one square of my char. So I search for colors and get a TPA then I go through the array and remove points within a certain point range.

Le Jingle

2013-02-16 16:05:18


var
playerTPAtoClear : TPointArray;
begin
// ... stuff
playerTPAtoClear := TPAFromBox(IntToBox(242, 152, 268, 239-50)); // box of our player on the MainScreen

// this will take theGatheredTPA, delete from it the playerTPAtoClear, and then give back the theGatheredTPA minus the (if any) playerTPAtoClear that we wanted removed
ClearTPAFromTPAWrap(theGatheredTPA, playerTPAtoClear, theGatheredTPA);

bud_wis_er_420

2013-02-16 16:11:12

From: Le Jingle

var
playerTPAtoClear : TPointArray;
begin
// ... stuff
playerTPAtoClear := TPAFromBox(IntToBox(242, 152, 268, 239-50)); // box of our player on the MainScreen

// this will take theGatheredTPA, delete from it the playerTPAtoClear, and then give back the theGatheredTPA minus the (if any) playerTPAtoClear that we wanted removed
ClearTPAFromTPAWrap(theGatheredTPA, playerTPAtoClear, theGatheredTPA);



Thx alot M8!!

bud_wis_er_420

2013-02-16 18:04:02

Ok one more. Same as before but now I need to remove a string from an array?

Is there a list of the array functions somewhere?


Edir:

I think I figured it out. But I know there is got to be a shorter way?
ItemsToKeep := ['cod', 'bass'];

ItemList := ['shark', 'lobster', 'swordfish', 'cod', 'bass', 'mackerel',
'boots', 'gloves', 'seaweed', 'casket', 'oyster'];
c := 0;
for i := 0 to High(ItemList) do
begin
add := false;
for j := 0 to High(ItemsToKeep) do
begin
if (ItemsToKeep[j] = ItemList[i]) then
add := true;
end;
if (add = true) then
DropList[c] := ItemList[i];
inc(c)
end;

Le Jingle

2013-02-16 18:54:19

We'll, when dropping, you could compare the found text against the itemsToKeep, and say, if the found text during runtime does not match elements in your itemstokeep string array, then to drop w/e item that is found. This may or may not be ideal for what you are writing, but it would offer less checking to be carried out while still accomplishing the goal of keeping the wanted items and disposing of the unwanted items.