PDA

View Full Version : My Feather Buyer



I Pick Axes
10-02-2006, 03:41 PM
This is a feather buyer script I made for the Port Sarim fishing shop. Start somewhere near the shop, but not directly on top of the minimap symbol. This does have some issues in a crowded world. (finding minimap symbol as well as finding shopkeeper)

program Featherbuyer;
//Buys feathers in Port Sarim

{.include SRL\SRL.scar}

const
fishmap = 10130433; //Fishing shop map icon, pick distinct color.
shopkeeper = 6127242; //Shopkeeper color, maybe his hat.

var
bought, iter : integer;

Procedure DoSetup; //Setup of SRL
begin
SetupSRL;
bought := 0;
iter := 0;
GameTab(4);
end;

Procedure DoBuy; //One click of buy
begin
Mouse(370,73,20,20,false);
if (random(3)=1) then
begin
ClickOption('Buy 5',1);
bought := bought + 5;
end
else
begin
ClickOption('Buy 10',1);
bought := bought + 10;
end;
end;

Procedure MyReport; //Randoms and purchases report
begin
SRLRandomsReport;
Writeln('');
Writeln('We have bought ' + IntToStr(bought) + ' feathers.');
Writeln('');
end;

Procedure WalkOff; //Go off on a stroll
begin
CloseWindow;
Wait(100+random(100));
MouseFlag(604,77,25,50);
Wait(100+random(100));
end;

Procedure GetBack; //Get to the fish shop and trade the shopkeeper
begin
repeat
ClickMMColorTol(fishmap,5);
Wait(100+random(100));
until (FlagPresent);
Flag;
repeat
FindColorSpiralTolerance(x,y,shopkeeper,random(500 ),random(300),500,300,5);
MMouse(x,y,5,5);
until(IsUpText('Gerrant'));
Mouse(x,y,5,5,false);
ClickOption('Trade',1);
Flag;
Wait(random(500));
end;

begin //Main Loop
DoSetup;
repeat
GetBack;
repeat
DoBuy;
iter := iter + 1;
If(InChatMulti('have enough', 'stock', 'coins')) then break;
until (iter > (25 + random(5)));
WalkOff;
FindNormalRandoms;
until (InChatMulti('have enough', 'stock', 'coins'));
end.