PDA

View Full Version : Help with feather buyer



krunkjuice
12-04-2006, 10:55 PM
Ok I wrote a featherbuyer and I need some help with it. It's not my first script but it might as well be because my last few were completely terrible lol. Anyways, I took a huge chunk of it from phantom bmxs buyer so sorry for that but the script is just for learning purposes so I hope you wont get upset. I get a dumb error when I compile because I think somethings wrong with my SRL. Anyways, I pretty much filled in the gaps of what I didnt know how to do in the script with what I though woudl go there, lol. I know it is riddled with mistakes, errors, and fauls ( especially in the main loop) so I would appreciate any help that you could give me, thanks. :)


// --- Feather Buyer ---
//[ Start in fishing shop logged in, and thats it]





program Feathers;
function FindGerrant:Boolean; //taken from delux feather buyer.
var a,b:integer;
begin
if(GetColor(342, 44)=2070783)then
begin
Result:=True;
Exit;
end;
a:=246;
b:=163;
if(FindColorSpiralTolerance(a,b,6785945,10,10,500, 330,3))or
(FindColorSpiralTolerance(a,b,7708590,10,10,500,33 0,3))or
(FindColorSpiralTolerance(a,b,7444904,10,10,500,33 0,3))then
begin
Mouse(a,b,0,0);
Wait(100+random(50));
if(Option2('Talk'))or
(IsUpText('Talk'))then
begin
Mouse(a,b,0,0,false);
IdleWait(100+random(20));
ChooseOption(a,b,'Trade');
Flag;
IdleWait(1000+Random(1000));
end;
Procedure Buyfeather;
if(ShopScreen)=true then
begin
Mouse(500+random(20), 287+random(20),false);
if(isuptext('Buy 10')) then
begin
Mouse(486+random(20), 356+random(20),true);
end;

Begin
if(FindGerrant) = true then
repeat
Buyfeather;
until
end;
end.

Hey321
12-04-2006, 11:11 PM
Ok, well i edited a bit and it compiles now not sure if it works tho.



// --- Feather Buyer ---
//[ Start in fishing shop logged in, and thats it]





program Feathers;
{.include SRL/SRL.scar}
function FindGerrant:Boolean; //taken from delux feather buyer.
begin
if(GetColor(342, 44)=2070783)then
begin
Result:=True;
Exit;
end;
x:=246;
y:=163;
if(FindColorSpiralTolerance(x,y,6785945,10,10,500, 330,3))or
(FindColorSpiralTolerance(x,y,7708590,10,10,500,33 0,3))or
(FindColorSpiralTolerance(x,y,7444904,10,10,500,33 0,3))then
begin
Mouse(x,y,3,3,False);
Wait(100+random(50));
if(Option2('Talk'))or
(IsUpText('Talk'))then
begin
Mouse(x,y,3,3,false);
Sleep(100+random(20));
ChooseOption(x,y,'Trade');
Flag;
Sleep(1000+Random(1000));
end;
end;
end;
Procedure Buyfeather;
begin
Mouse(500, 287, 20, 20,false);
if(isuptext('Buy 10')) then
begin
Mouse(486, 356, 20, 20,true);
end;
end;

Begin
SetupSRL;
Repeat
if(FindGerrant = true) then
Buyfeather;
until(false)
end.

krunkjuice
12-05-2006, 09:10 PM
Thanks, but I'm redoing it with a littel code from the previous script. Anyways I have another question now. If I use the "amount" function, what exacly do I put in for the peramiters. Like would I put in 'shop' or 'feather', and what is the integer for? Example; if I wanted it to buy the feathers when it got to 960 or more woudl I do this, if amount('shop', 960) >= 960 then?

Hey321
12-05-2006, 09:51 PM
I have no idea :). If i did i'd probably be an srl member lol.

TOB
12-05-2006, 11:37 PM
{************************************************* ******************************
function Amount(area: String; i: Integer): Integer;
By: masquerader
Description: Returns the ammount of an item specified by i in an area.
************************************************** *****************************}

function Amount(area: string; i: Integer): Integer;
//i= position
var
coords: tpoint;
begin
result := 0;
if (checkarea(area)) then
begin
coords := amountcoords(area, i);
result := getamount(coords.x, coords.y);
end;
end;

Always use your SRL manual first to check for things.

Amount calls CheckArea so you need to know what that is:


{************************************************* ******************************
function CheckArea(area: String): Boolean;
By: masquerader
Description: Checks if the given interface is opened.
************************************************** *****************************}

function CheckArea(area: string): Boolean;
begin
case lowercase(area) of
'inv', 'inventory':
begin
//automatically tab 4 in all of these cases i think..
if (bankscreen or shopscreen or tradescreen or tradescreen2) then
result := true
else if (gametab(4)) then
result := true;
end
'shop':
begin
if (shopscreen) then
result := true;
end;
'bank':
begin
if (bankscreen) then
begin
fixbank;
result := true;
end;
end;
'trade', 'your trade':
begin
if (tradescreen) then
result := true;
end;
else invalidoption(area);
end;
if (result = false) then
writeln('PROBLEM: ' + area + ' interface not open');
end;

krunkjuice
12-06-2006, 12:32 AM
Ohhhhh I get it, thanks both of you +rep.