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
i know it may be a bit long but it produces accurate and fast results
you can test it with the following script
this is faster than the current method of finding symbols, uses less memory and can take exactly the same arguments
only 62 MS
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




