SRL Archive - RS3 Script Requests

Dragonhide tanner


nicerman1

2014-12-29 06:14:55

Hi

I'd really like a script that does the following:
Deposit whole inventory at bank
walk to tanner (in either al-Kharid or in Varrock)
find tanner
tan hides
walk back to bank
repeat
I already tried myself, but i failed at the find tanner part and i just can't figure it out. So now i'm asking for professional scripters to make one, so i can use it (and probably also learn from it)

if someone wants to see my (really really bad script) you can see it here, but i don't think you can use a lot of it.
program DragonHideTanner;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}


procedure MinimapBanking()
var
MinimapBox: TBox;
LocationBank: TPoint;
LocationTannerIcon: TPoint;

x1,y1,x2,y2 : Integer;
begin

MinimapBox:= intToBox(474,12, 797,200);
minimap.findSymbol( LocationBank, MM_SYMBOL_BANK, MinimapBox);
mouse(LocationBank,MOUSE_LEFT);
wait(randomRange(25000,26500));
mainscreen.findObject(x1, y1, 1843477, 11, ['ank'], MOUSE_RIGHT);
chooseOption.select(['ank']);


wait(randomRange(1500,3000));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(1000,1750));
bankScreen.withdraw(1, 28, ['reen']) ;

wait(randomRange(500,1000));
bankScreen.close();
wait(randomRange(500,1000));
minimap.findSymbol(LocationTannerIcon ,MM_SYMBOL_TANNER,MinimapBox);

mouse(LocationTannerIcon,MOUSE_LEFT);
wait(randomRange(25000,26500));
mainscreen.findObject(x2, y2, 3756451, 10, ['llis'], MOUSE_RIGHT);
wait(randomRange(500,1000));
chooseOption.select(['an']);
wait(randomRange(500,1250));
productionscreen.clickStart(true);
wait(randomRange(500,2000));

end
begin
clearDebug();
setupSRL();
repeat
MinimapBanking();
until false
end

Harrier

2014-12-29 06:44:41

There may, or may not be one in a higher forum ;)

Sjoe

2014-12-29 07:09:14

From: Harrier
There may, or may not be one in a higher forum ;)


Not sure why people always say this?
Kinda triggers the spamming to 30 posts

bonsai

2014-12-29 07:56:45

I wrote a little findEllis() function for @Ross once upon a time but I lost it. Maybe he still has it.

Very nice for your first script by the way!

Please don't be discouraged… every time you find something hard like this there's a solution. It just takes a little effort (and sometimes some help from a friend).

Finding Ellis is a challenge because most of the colors involved also match background areas.

fastler

2014-12-29 08:44:40

From: bonsai
I wrote a little findEllis() function for @Ross once upon a time but I lost it. Maybe he still has it.


I believe the function in question found two colors, and located Ellis by checking/filtering the distance between the two separate colors.

cosmasjdz

2014-12-29 09:07:24

From: fastler
I believe the function in question found two colors, and located Ellis by checking/filtering the distance between the two separate colors.


Iv wrote him some script yesterday but he doesnt use regular graphics parameters and interfaces so much of srl6 include functions doesnt work. I thought of localizing search area by finding ellis area using mmtoms function then searching in that area his head and/or legs. But ross tanners finding function is very good indeed. He just searches for head and white apron and determines if both tpa is close to each another.

Basicly what you nicer need is to learn to work with tpa/atpa stuff.

Simpliest finding functions and their use using tpa are like

findcolorsspiraltolerance(); to search for colors using most probable color, tolerance hue, sat modifiers whcih you get from ACA autocolor aid thingy i showed yesterday.

Then when you get tpa, the points which are that color you need somehow to sort them and remove wrong posibilities.

Personally i like using clustertpa() or toatpa() Then you need to remove false atpa posibilies by filtering them
like filterbetween().

Do that to find elis head, then find apron. and sort out howmuch should be the distance between them. And youll have your kind of difficult object finding problem solved.

Basic framework using finding colors is something similar like this":

procedure Whatever();
var
x,y,i:integer; //need to define because findcolorspiraltolerance returns x,y coordinates of color found
TPA: TPointArray; // its point array
ATPA: T2DPointArray; // its array of t points array
begin
findcolorsspiraltolerance(x,y,tpa,3622482,elis(),8,colorSetting(2,0.63, 1.45)); // search for //for example here for ellis head using ACA generated best color match.
if length(TPA) < 1 then exit;// needed to prevent script crash if there is no tpa found.
atpa:= clustertpa(tpa, 4); // sorts tpa into groups which atleast by 4 pixels range has //mentioned color. If range is over 4 then it may generate another atpa, Depending on situation it
// can be like from 0 to like 5000 or more atpa items.
if length(atpa)<1 then exit; // if somehow didnt managed to sort tpa to any atpa doesnt crash
atpa.filterBetween(0, 15); //Filters atpas which has smaller than 15 amount of tpa inside
smartImage.debugTPA(TPA,true); // just for debugging
SmartImage.debugATPA(atpa);// debugging usage
//Also you can then if you have atpa move your mouse to the middle of selected atpa
// or try all atpas found for example:
for i:=0 to high(atpa)do
begin
mouse(middletpa(atpa[i]),mouse_move);
if ismouseovertext(['sample']) then
begin
fastclick(mouse_right);
exit;
end;
end;
end;

nicerman1

2014-12-29 10:59:15

So where do i start, i have some experience with coding (java). But where is the best place to start to solve this problem. I completly understand you want to let me search intstead of just give me the answer, but does anyone have tips? Thanks
P.S: Sorry for the "spam"

Ross

2014-12-29 11:24:18

Basically going off of what bonsai said, you need to find two TPAs. One could be the color of his shirt and the other his pants or apron. Turn one of the TPAs into an ATPA via tpa.cluster() and then use the function tpa.isPointNear() to check if the two TPAs found are near each other, and filter everything that isn't out.

cosmasjdz

2014-12-29 11:38:33

From: nicerman1
So where do i start, i have some experience with coding (java). But where is the best place to start to solve this problem. I completly understand you want to let me search intstead of just give me the answer, but does anyone have tips? Thanks
P.S: Sorry for the "spam"


I used this guide

https://villavu.com/forum/showthread.php?t=107757

Basicly i learned everything from it at start here, havent used any other gides i think but learned by solving problems having solid foundations. This guide gives solid foundations for first step. Also explains dtms, sps walking, bitmaps, basicly everything simba uses.

nicerman1

2014-12-29 12:27:57

thanks guys, will check it out and think about it some more

johnjoseph09

2014-12-30 07:58:21

Im going to start this tanning script, I've made one but needs a lot more modifications. So good to see people encouraging new scripters.

The Mayor

2014-12-30 19:16:45

I once wrote an Ellis function for someone too. I forgot who it was though.

Joopi

2015-01-08 22:52:25

Working on a remake of Pipos one since its outdated