SRL Archive - First Scripts

Yetttis Coal and Iron Buyer


yettti

2007-12-13 12:54:27

This is my first script (kinda, i made a auto talker but that dont realy count…) this script automaticly walks to the Grand Exchange , buys iron and coal and walks back

setup
-Place at bank next to the symbol
-Make shure no pathway can be seen at the top left of the screen
-Put money either in inventory or in first bank slot
-Go…Go…Go!!!

Naum

2007-12-13 13:27:06

Well for starters :p .
Line 17: [Error] (14698:12): Unknown identifier 'INTEGER' in script C:\Documents and Settings\Admin.-890\Local Settings\Temporary Internet Files\Content.IE5\FHV84BTQ\Iron%20and%20Coal[1].scar
Help me pwetty please

Sir R. M8gic1an

2007-12-13 14:37:50

looks liek a good effort,
here's some tips:
repeat -> until doesn't need begin and end,

Mouse(....)
wait(...)
Flag;
no need for wait, Flag will do the waiting for you

Typesend(Coal) needs to be TypeSend('coal') (notice the ' '?)

also you walk through coords sometimes. not reliable at all. but congradulations on radial walk! your walking on the path to members ;)

also a script suggestion: there a bank at the grand exchange, no need to walk there :p

~RM

yettti

2007-12-13 14:41:05

i see your point, forgot to remove a bit… wont change it now… and btw… walk to bank was so that it could try out radial walk and wait was cuz mi computers laggy

Rikje

2007-12-13 15:43:53

looks ok, thats a nice start! :)

i made this a short time ago. (posted in members).
maby you can get some idees out of it ;)
FindExchange screen etc.

program GrandExchange;
{.include srl/srl.scar}
var
Log: Integer;


Function FindExchangeScreen: Boolean;
var
Tx, Ty: integer;
begin
Result := IsTextInAreaEx(190, 30, 328, 52, Tx, Ty, 'Grand Exchange', 10, UpChars,
True, False, 0, 0, 39116);
end;

Function OpenExchange: Boolean;
var
Cx, Cy: Integer;
begin
Result := FindObjCustom(Cx, Cy, ['Desk', 'Use Desk'], [6850714], 10);
if Result then
begin
Mouse(Cx, Cy, 2, 2, False);
ChooseOption('Exchange ');
Flag;
Wait(2000);
if FindExchangeScreen then
begin
Result := True;
Exit;
end;
end;
Result := False;
end;

procedure CloseExchenge;
var
C: Integer;
begin
if FindExchangeScreen then
repeat;
Inc(c);
Mouse(485, 42, 3, 3, True);
Wait(1000);
until((C >= 2) or (Not(FindExchangeScreen)));
end;

Function LookForOpenSlot(var Tx, Ty, Slot: Integer): Boolean;
var
SlotCoords: Array [0..5] Of TPoint;
I: Integer;
begin
SlotCoords[0].x := 79; SlotCoords[4].x := 237;
SlotCoords[0].y := 86; SlotCoords[4].y := 206;
SlotCoords[1].x := 238; SlotCoords[5].x := 395;
SlotCoords[1].y := 86; SlotCoords[5].y := 206;
SlotCoords[2].x := 394; Slot := 0;
SlotCoords[2].y := 86;
SlotCoords[3].x := 82;
SlotCoords[3].y := 206;

MMouse(530, 219, 10, 30);
For I := 0 to 5 do
begin
Result := IsTextInAreaEx(SlotCoords[i].x, SlotCoords[i].y, SlotCoords[i].x + 55,
SlotCoords[i].y + 25, Tx, Ty, 'Empty', 20, UpChars, True, False, 0, 0, 39372);
if Result then
begin
Slot := i + 1;
Exit;
end;
end;
end;

Function ExchangeSellItem(ItemBitmap: Integer; SellAmount: string;
LowestPrize: Boolean; ItemTol: Integer): Boolean;
var
Tx, Ty, Slot: Integer;
begin
if OpenExchange then
begin
if LookForOpenSlot(Tx, Ty, Slot) then
begin
WriteLn('Free Slot: ' + IntToStr(Slot));
Mouse(Tx + 10, Ty, 20, 30, True);
Wait(1000 + Random(500));
Mouse(Tx + 35, Ty + 50, 20, 10, True);
Wait(2000 + Random(500));
if (not(TabExists(4))) then
begin
if FindBitmapToleranceIn(ItemBitmap, Tx, Ty, MIX1, MIY1, MIX2, MIY2, ItemTol) then
begin
Mouse(Tx, Ty, 2, 2, True);
Wait(2000 + Random(500));
if FindDeformed(Tx, Ty, ItemBitmap, 104, 94, 147, 134) then
begin
Mouse(237, 223, 3, 3, True);
if (not(FindExchangeScreen)) then Exit;
Wait(2000 + Random(500));
TypeSend(SellAmount);
Wait(2000 + Random(500));
if LowestPrize then
Mouse(286, 222, 3, 3, True)
else Mouse(339, 223, 3, 3, True);
Mouse(216, 285, 100, 10, True);
Wait(2000 + Random(500))
Result := True;
end;
end;
end;
end;
end;
CloseExchenge;
end;

procedure Load; //current bitmap is from a noted willow log.
begin
Log := BitmapFromString(9, 4, 'beNrzkY8MUERGsSFKoT7ygZ6yP' +
'q4yQDYcQUQ8HKScbSTszMWAKoEiQAaQCxQEIqAsUASIIFyICEQQaC' +
'AIAQCcZhmX');
end;

begin
SetUpSRl;
Load;
if ExchangeSellItem(Log, '50', True, 20) then
WriteLn(' Sucsefully Exchanged.');
CloseExchenge;
FreeBitmap(Log);
end.

Good Luck :)