SRL Archive - SRL Suggestions

Add to Symbols.scar


Shuttleu

2010-07-13 20:05:33

okay so after a bit of testing with the original values, it doesnt work as well as planned
but i have come up with the following
{*******************************************************************************
function LoadSymbolInfo(Which: string): TIntegerArray;
By: Shuttleu
Description: Loads symbol colors defined by Which for NewFindSymbol
*******************************************************************************}
function LoadSymbolInfo(Which: string): TIntegerArray;
begin
case Which of
'shop', 'store': Result:= [3438013, 1267372];
'sword shop': Result:= [7489852, 12632256];
'magic shop', 'rune shop': Result:= [2598128, 1669374];
'axe shop': Result:= [2905984, 4935243];
'helmet shop': Result:= [6842471, 11777460];
'bank': Result:= [2216175, 1134443];
'quest': Result:= [14908517, 12536885];
'mining spot', 'mining site', 'mine': Result:= [1391463, 4144702];
'furnace': Result:= [1669374, 612599];
'anvil': Result:= [4144702, 7698038];
'combat training', 'training dummy': Result:= [2061195, 5077645];
'dungeon', 'underground': Result:= [987039, 6776811];
'staff shop': Result:= [4017582, 2905984];
'platebody shop': Result:= [6842471, 7698038];
'platelegs shop': Result:= [8553348, 6842471];
'scimitar shop': Result:= [14869472, 9933198];
'archery shop': Result:= [5077645, 4144702];
'shield': Result:= [8553348, 7698038];
'altar': Result:= [16645886, 8553348];
'jewellery shop', 'jewelery': Result:= [7653360, 118747];
'gem stall': Result:= [2698232, 5263608];
'crafting shop': Result:= [1383204, 6842471];
'fishing shop', 'fish store': Result:= [12550675, 12632256];
'fishing spot', 'fish': Result:= [14630407, 10422865];
'clothes': Result:= [3636519, 4231731];
'apothecary': Result:= [16078233, 13773675];
'silk stall': Result:= [13773675, 6949278];
'kebab seller': Result:= [2698232, 386];
'bar': Result:= [2596292, 7653360];
'mace shop': Result:= [2839403, 5789784];
'tannery': Result:= [1134443, 2905984];
'rare trees', 'tree': Result:= [84998, 880132];
'spinning wheel', 'spin': Result:= [1391463, 12632256];
'food shop', 'food store': Result:= [7582397, 6984380];
'cooking shop': Result:= [7698038, 6842471];
'activity': Result:= [2566602, 197581];
'water source', 'water': Result:= [14798275, 16279593];
'cook', 'cookery': Result:= [1391463, 796487];
'plateskirt shop': Result:= [12872394, 11556277];
'pottery', 'pot': Result:= [923206, 796487];
'windmill', 'mill': Result:= [1179385, 2048535];
'mining shop': Result:= [1179385, 65536];
'chainmail shop': Result:= [5789784, 8553348];
'fur trader': Result:= [343427, 386];
'hairdresser', 'hair dresser': Result:= [10461087, 65536];
'makeover mage': Result:= [9944037, 6984380];
'guide': Result:= [9068094, 13809559];
'transportation': Result:= [4935243, 5789784];
'holiday event': Result:= [2598128, 10461087];
'achievement diary': Result:= [494860, 880132];
'grand exchange': Result:= [3438013, 6984380];
'resting spot', 'rest': Result:= [4144702, 990223];
'games': Result:= [90, 6514826];
'churn': Result:= [1062994, 4935243];
'portal': Result:= [16078233, 13902727];
'farming spot': Result:= [10461087, 796487];
'agility': Result:= [12632256, 65536];
'house': Result:= [4415855, 7698038];
'spice stall': Result:= [612599, 5263819];
'silver stall': Result:= [16645886, 8553348];
'farming shop': Result:= [343427, 1267372];
'slayer master': Result:= [9697013, 7207413];
'herbalist': Result:= [1989194, 84998];
'candle shop': Result:= [11393512, 7582397];
'saw mill': Result:= [1727107, 1134443];
'short cut': Result:= [4374019, 2783749];
'hunter store': Result:= [2839403, 2964820];
'hunter training': Result:= [2305322, 5789784];
'sandpit': Result:= [7653360, 4694448];
'pet shop': Result:= [7698038, 990223];
'summoning store': Result:= [7582397, 13626106];
end;
end;

{*******************************************************************************
function FindSymbol(var x, y: Integer; Which: string): Boolean;
By: Shuttleu
Description: Finds the symbol 'Which' and returns True if found and the points
in x and y
*******************************************************************************}
function FindSymbol(var x, y: Integer; Which: string): Boolean;
var
i, FirstColor, SecondColor: Integer;
FoundPoints: TPointArray;
SymbolData: TIntegerArray;
begin
SymbolData:= LoadSymbolInfo(Which);

if (Length(SymbolData)<1) then
begin
Writeln('Unknown symbol name '''+Which+'''');
Exit;
end;

FirstColor:= SymbolData[0];
SecondColor:= SymbolData[1];

if FindColorsPie(FoundPoints, FirstColor, 0, 0, 360, 0, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
for i:=0 to High(FoundPoints) do
if (GetColor(FoundPoints[i].x+1, FoundPoints[i].y)=SecondColor) then
begin
Result:= True;
x:= FoundPoints[i].x;
y:= FoundPoints[i].y;
Break;
end;
end;

i know it may be a bit long but it produces accurate and fast results

you can test it with the following script
{$i srl/srl.scar}

var
x, y, timer: Integer;


{*******************************************************************************
function LoadSymbolInfo(Which: string): TIntegerArray;
By: Shuttleu
Description: Loads symbol colors defined by Which for NewFindSymbol
*******************************************************************************}
function LoadSymbolInfo(Which: string): TIntegerArray;
begin
case Which of
'shop', 'store': Result:= [3438013, 1267372];
'sword shop': Result:= [7489852, 12632256];
'magic shop', 'rune shop': Result:= [2598128, 1669374];
'axe shop': Result:= [2905984, 4935243];
'helmet shop': Result:= [6842471, 11777460];
'bank': Result:= [2216175, 1134443];
'quest': Result:= [14908517, 12536885];
'mining spot', 'mining site', 'mine': Result:= [1391463, 4144702];
'furnace': Result:= [1669374, 612599];
'anvil': Result:= [4144702, 7698038];
'combat training', 'training dummy': Result:= [2061195, 5077645];
'dungeon', 'underground': Result:= [987039, 6776811];
'staff shop': Result:= [4017582, 2905984];
'platebody shop': Result:= [6842471, 7698038];
'platelegs shop': Result:= [8553348, 6842471];
'scimitar shop': Result:= [14869472, 9933198];
'archery shop': Result:= [5077645, 4144702];
'shield': Result:= [8553348, 7698038];
'altar': Result:= [16645886, 8553348];
'jewellery shop', 'jewelery': Result:= [7653360, 118747];
'gem stall': Result:= [2698232, 5263608];
'crafting shop': Result:= [1383204, 6842471];
'fishing shop', 'fish store': Result:= [12550675, 12632256];
'fishing spot', 'fish': Result:= [14630407, 10422865];
'clothes': Result:= [3636519, 4231731];
'apothecary': Result:= [16078233, 13773675];
'silk stall': Result:= [13773675, 6949278];
'kebab seller': Result:= [2698232, 386];
'bar': Result:= [2596292, 7653360];
'mace shop': Result:= [2839403, 5789784];
'tannery': Result:= [1134443, 2905984];
'rare trees', 'tree': Result:= [84998, 880132];
'spinning wheel', 'spin': Result:= [1391463, 12632256];
'food shop', 'food store': Result:= [7582397, 6984380];
'cooking shop': Result:= [7698038, 6842471];
'activity': Result:= [2566602, 197581];
'water source', 'water': Result:= [14798275, 16279593];
'cook', 'cookery': Result:= [1391463, 796487];
'plateskirt shop': Result:= [12872394, 11556277];
'pottery', 'pot': Result:= [923206, 796487];
'windmill', 'mill': Result:= [1179385, 2048535];
'mining shop': Result:= [1179385, 65536];
'chainmail shop': Result:= [5789784, 8553348];
'fur trader': Result:= [343427, 386];
'hairdresser', 'hair dresser': Result:= [10461087, 65536];
'makeover mage': Result:= [9944037, 6984380];
'guide': Result:= [9068094, 13809559];
'transportation': Result:= [4935243, 5789784];
'holiday event': Result:= [2598128, 10461087];
'achievement diary': Result:= [494860, 880132];
'grand exchange': Result:= [3438013, 6984380];
'resting spot', 'rest': Result:= [4144702, 990223];
'games': Result:= [90, 6514826];
'churn': Result:= [1062994, 4935243];
'portal': Result:= [16078233, 13902727];
'farming spot': Result:= [10461087, 796487];
'agility': Result:= [12632256, 65536];
'house': Result:= [4415855, 7698038];
'spice stall': Result:= [612599, 5263819];
'silver stall': Result:= [16645886, 8553348];
'farming shop': Result:= [343427, 1267372];
'slayer master': Result:= [9697013, 7207413];
'herbalist': Result:= [1989194, 84998];
'candle shop': Result:= [11393512, 7582397];
'saw mill': Result:= [1727107, 1134443];
'short cut': Result:= [4374019, 2783749];
'hunter store': Result:= [2839403, 2964820];
'hunter training': Result:= [2305322, 5789784];
'sandpit': Result:= [7653360, 4694448];
'pet shop': Result:= [7698038, 990223];
'summoning store': Result:= [7582397, 13626106];
end;
end;

{*******************************************************************************
function FindSymbol(var x, y: Integer; Which: string): Boolean;
By: Shuttleu
Description: Finds the symbol 'Which' and returns True if found and the points
in x and y
*******************************************************************************}
function NewFindSymbol(var x, y: Integer; Which: string): Boolean;
var
i, FirstColor, SecondColor: Integer;
FoundPoints: TPointArray;
SymbolData: TIntegerArray;
begin
SymbolData:= LoadSymbolInfo(Which);

if (Length(SymbolData)<1) then
begin
Writeln('Unknown symbol name '''+Which+'''');
Exit;
end;

FirstColor:= SymbolData[0];
SecondColor:= SymbolData[1];

if FindColorsPie(FoundPoints, FirstColor, 0, 0, 360, 0, 70, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY) then
for i:=0 to High(FoundPoints) do
if (GetColor(FoundPoints[i].x+1, FoundPoints[i].y)=SecondColor) then
begin
Result:= True;
x:= FoundPoints[i].x;
y:= FoundPoints[i].y;
Break;
end;
end;

begin
MarkTime(Timer);
writeln('Symbol Found:'+BoolToStr(NewFindSymbol(x, y, 'rest'))+' X:'+inttostr(x)+' Y:'+inttostr(y)+' Took:'+IntToStr(TimeFromMark(Timer))+'MS to run FindSymbol');
end.

this is faster than the current method of finding symbols, uses less memory and can take exactly the same arguments

only 62 MS

Coh3n

2010-07-13 23:56:11

Naming should be

symbol_Mining
symbol_Furnace
.
.
.
to keep the same naming scheme as the gametabs and skills. And do we have a Constants.scar? Or do you mean Globals?

ZephyrsFury

2010-07-14 03:13:12

Did a bit of testing:

Seems to work most of the time. PubSymb finds the furnace symbol. ShieldSymb finds the general store symbol. Duplicate MiningSymb, I don't know which one's the correct one. Interesting that some symbol colours are constant though.

Shuttleu

2010-07-14 05:26:35

i will rename them, repick some of the colors and do a bit more thorough testing

~shut

Wizzup?

2010-07-14 05:57:34

Wait what? All those colours are static? Wow.

Shuttleu

2010-07-14 06:55:11

From: Wizzup?
Wait what? All those colours are static? Wow.

yes, i discovered that when i was checking if the relations in NewAutoColor.scar was still working

i tried it with a rock and bank symbol and the bank symbol stayed the same no matter how many times i reloaded the client

i tried it with some other symbols and they all seem to be static

~shut

EDIT: Because some Symbols contain the same colors as others and there are no unique colors
i have come up with an idea
i shall have it written up in about an hour, maybe less

Shuttleu

2010-07-14 09:16:10

updated first post

~shut

Coh3n

2010-07-14 12:37:33

From: Shuttleu
updated first post

~shut

I would still rather see constants for the symbols than a TStringArray.

symbol_Fishing = 0;
symbol_Furnace = 1;
.
.
.
But that's just me.

Shuttleu

2010-07-14 12:56:32

From: Coh3n
I would still rather see constants for the symbols than a TStringArray.

symbol_Fishing = 0;
symbol_Furnace = 1;
.
.
.
But that's just me.

but in order to correctly identify the symbol, it needs 2 colors
unless you want to constants for each symbol?

plus it would be more difficult to do the function in the first post

also can a mod change the title of the thread, because it isnt about globals.scar

~shut

Coh3n

2010-07-14 12:58:59

From: Shuttleu
but in order to correctly identify the symbol, it needs 2 colors
unless you want to constants for each symbol?

plus it would be more difficult to do the function in the first post

also can a mod change the title of the thread, because it isnt about globals.scar

~shut

Title changed.

And with constants you wouldn't have to declare the names, but I didn't realize there were 2 colours for each symbol. In that case it may be better to have a 2D array. Would probably shorten up your code a lot too (and you could use constants).

Shuttleu

2010-07-14 13:33:14

how about that ^^^

~shut

Coh3n

2010-07-14 13:49:02

From: Shuttleu
how about that ^^^

~shut

Yeah, that works too. :)

I think you should turn the load procedure into a GetSymbolInfo function and have it return the 2D array, then just have a local var in the other function. Would avoid having to use another global var.

E: I also think you should make the names the same as the ones in Symbols.scar.

Shuttleu

2010-07-14 13:55:10

there you go :)

hope thats up to scratch

~shut

EDIT: hold up, another idea coming

Shuttleu

2010-07-14 16:05:01

okay, updated first post again
should now be more memory friendly, and faster too

i have also added a few more symbols and made it backwards compatible with the current FindSymbol

~shut

ZephyrsFury

2010-07-15 02:49:54

I did some more testing in Varrock mainly. Most symbols work. Ones that I can't seem to get working are 'dungeon' and 'sword shop'. I can't find Aubury's rune store on the list of available symbols.

Anyways good work :)

Shuttleu

2010-07-15 03:32:04

From: ZephyrsFury
I did some more testing in Varrock mainly. Most symbols work. Ones that I can't seem to get working are 'dungeon' and 'sword shop'. I can't find Aubury's rune store on the list of available symbols.

Anyways good work :)
that might be because i forgot the rune shop…

~shut

EDIT: i accidentally picked the wrong colors for the sword and dungeon, and the rune shop is magic shop
but the problems have been rectified and i have added rune shop

EDIT: @coh3n - just thought i would let you know that this isnt for AutoColor.scar, but Symbols.scar

EDIT: 62 MS

noidea

2010-07-15 09:20:39

Its nice, but somehow, I can see this being a lot easier for jagex to break than the current bitmap implementation. Anywho, nice work mate.

Coh3n

2010-07-15 17:17:27

From: Shuttleu

EDIT: @coh3n - just thought i would let you know that this isnt for AutoColor.scar, but Symbols.scar

My bad, fixed. :)

Shuttleu

2010-07-15 17:45:38

From: noidea
Its nice, but somehow, I can see this being a lot easier for jagex to break than the current bitmap implementation. Anywho, nice work mate.

but with the current FindSymbol, its slower and you need most of the symbol uncovered

whereas with this you only need a tiny bit uncovered and it is accurate

~shut

~shut

Blumblebee

2010-07-15 17:52:51

um before we all get carried away, I don't think they actually are static. I thought they were too (a couple months ago) and I thought I was a genius for finding it out because it worked for like 2 weeks or something silly like that, but the colors do eventually change. Using the bitmap system we have now is much better for the long term and doesn't require updating. But that was just me, or atleast what I found.

Edit: although then again the colors have to be in a ballpark assumingly, thus having constant colors and searching with a tolerance of 5(ish) should still find the color so I guess having them in the include wouldn't hurt.

NCDS

2010-07-15 18:15:45

From: Blumblebee
um before we all get carried away, I don't think they actually are static. I thought they were too (a couple months ago) and I thought I was a genius for finding it out because it worked for like 2 weeks or something silly like that, but the colors do eventually change. Using the bitmap system we have now is much better for the long term and doesn't require updating. But that was just me, or atleast what I found.

Edit: although then again the colors have to be in a ballpark assumingly, thus having constant colors and searching with a tolerance of 5(ish) should still find the color so I guess having them in the include wouldn't hurt.


The problem then being that plenty of Symbol colors are very similar and could result in false positives with even the slightest tolerance.

I use a method similar to this in my scripts, just for finding a tree symbol etc though, not for all symbols. I don't know as this would be reliable enough for long term use.

I could be wrong, but I think this should be tested for a while before any actual changes are made.

Shuttleu

2010-07-15 20:14:31

From: NCDS
The problem then being that plenty of Symbol colors are very similar and could result in false positives with even the slightest tolerance.

I use a method similar to this in my scripts, just for finding a tree symbol etc though, not for all symbols. I don't know as this would be reliable enough for long term use.

I could be wrong, but I think this should be tested for a while before any actual changes are made.


a month or two long enough for you?

~shut

NCDS

2010-07-15 20:17:09

From: Shuttleu
a month or two long enough for you?

~shut


Ultimately it's not up to me, it's the dev's you need to impress.

Yes though, if this were to be working properly for 2 months+ without requiring any updates, I would feel comfortable using it. However, that's assuming it doesn't result false positives with any of the symbols.

Sir R. M8gic1an

2010-07-16 07:45:45

I would say write a guide on how to update this. That would be the most important thing.

Lately several symbol finding systems have been made, but we never really replaced the one in SRL. I think we could do something about that.


const
Symbol_General_Shop = 0;
Symbol_Sword_Shop = 1;
Symbol_Rune_Shop = 2;

case Which of
'shop', 'store': Result:= [3438013, 1267372];
'sword shop': Result:= [7489852, 12632256];
'magic shop', 'rune shop': Result:= [2598128, 1669374];

case Which of
Symbol_General_Shop: Result:= [3438013, 1267372];
Symbol_Sword_Shop: Result:= [7489852, 12632256];
Symbol_Rune_Shop: Result:= [2598128, 1669374];

~RM

Shuttleu

2010-07-16 10:50:38

From: Rasta Magician
I would say write a guide on how to update this. That would be the most important thing.

Lately several symbol finding systems have been made, but we never really replaced the one in SRL. I think we could do something about that.


const
Symbol_General_Shop = 0;
Symbol_Sword_Shop = 1;
Symbol_Rune_Shop = 2;

case Which of
'shop', 'store': Result:= [3438013, 1267372];
'sword shop': Result:= [7489852, 12632256];
'magic shop', 'rune shop': Result:= [2598128, 1669374];

case Which of
Symbol_General_Shop: Result:= [3438013, 1267372];
Symbol_Sword_Shop: Result:= [7489852, 12632256];
Symbol_Rune_Shop: Result:= [2598128, 1669374];

~RM


sure that wont be hard at all ;)

i will have it in this thread very soon

~shut

EDIT: here you go

to add a color, (or simply update a color) you need to choose a color on the symbol, for this example i will use the sword shop symbol
this is the symbol which i will use to demonstrate (the red dot in the top corner is not part of the demonstration)

for the sword i have chosen to use the blue handle which is all the same color, i have marked the handle in red for easy identificatioin

the socond color is 1 pixel to the right of the first pixel chosen
so if i choose the blue handle i can use any of the pixels in red below

i decided to use the pixel marked in red below

so the second color would come from the pixel in red below

and that is how you get the two colors

Shuttleu

2010-09-23 14:14:49

i would like to say that this still works perfectly, even after 2 and a bit months and several (about 20?) updates :D

~shut