All pastes #493291 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-17 18:08 UTC
rendered paste body
program New;
{.include SRL\SRL.scar}
var
x,y,Chars,dx,dy,timesmined,reporttime,H,R:integer;
food,minedirection:string;
procedure setup;
begin
{-----------------------------------------------------------------------
Set Settings
-----------------------------------------------------------------------}
food:= 'Meal'      //set food to eat
minedirection:= 'Mine' // mine direction eg Mine upwards
R:= Random(1000)
{-----------------------------------------------------------------------+
Loads Wurm Character Set into Memory
+-----------------------------------------------------------------------}
wait(50);
FindWindowTitlePart('Wurm Online ', false);
wait(50);
H:= GetClientWindowHandle;
Chars:= LoadCharsFromFont2('Arial', 8, False, False, False, False);
{-----------------------------------------------------------------------+
Sets basic Settings + Returns Client Dimensions
+-----------------------------------------------------------------------}
if not(GetSCARVersion = 306)then TerminateScript;
GetClientDimensions(dx, dy);
timesmined:=0
reporttime:=0
ClearReport;
ClearDebug;
clickmouse(dx/2,dy/2,true);
end;

procedure check_break;
begin
if(IsTextInAreaEx(408, 520, 780, 580, x, y, 'You are', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin

SendArrowWait(0, 1500 + R);
end else;
if(IsTextInAreaEx(408, 520, 780, 580, x, y, 'The wall breaks!', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
SendArrowWait(0, 1500 + R);
end else;
end;

procedure check_pickaxe;
begin
wait(250 + random(250));
if(IsTextInAreaEx(408, 482, 780, 574, x, y, 'It is stuck.', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
if(IsTextInAreaEx(408, 482, 780, 574, x, y, 'You manage to free', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
end;
writeln('pickaxe stuck!');
      SendArrowWait(2, 500 + R);
        KeyDown(GetKeyCode('a'));
        Wait(1500 + R)
        KeyUp(GetKeyCode('a'));
        KeyDown(GetKeyCode('d'));
        Wait(1500 + R);
        KeyUp(GetKeyCode('d'));
      SendArrowWait(0, 500 + R);
      writeln('pickaxe should be free');
      end;
end;

procedure check_statima;
begin
if not(FindColorTolerance(x, y, 6793315, 159, 50, 170, 58, 50)) then
begin
wait(500+ random(500));
check_statima;
end else;
end;

procedure check_water;
begin
if not (getcolor(411, 603) = 13408665) then
begin
if not(FindColorTolerance(x, y, 9659474,13, 61, 44, 64, 50)) then
begin
writeln('we need to drink');
wait(500+ random(500))
if(IsTextInAreaEx(479, 32, 750, 458, x, y, 'water', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
ClickMouseSpline(x,y,0,0,false);
wait(500+ random(500))
if(IsTextInAreaEx(4, 65, 800, 470, x, y, 'Drink', 0, Chars, False, False, 0, 1, $FFFFFF)) then
ClickMouseSpline(x,y,0,0,true);
end else;
end else;
end else;
end;

procedure check_food;
begin
if not (getcolor(411, 603) = 13408665) then
begin
if not(FindColorTolerance(x, y, 4944003,121, 60, 170, 64, 50)) then
begin
writeln('we need to eat');
wait(500+ random(500))
if(IsTextInAreaEx(479, 32, 750, 458, x, y, food, 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
ClickMouseSpline(x,y,0,0,false);
wait(500+ random(500))
if(IsTextInAreaEx(4, 65, 800, 470, x, y, 'Eat', 0, Chars, False, False, 0, 1, $FFFFFF)) then
ClickMouseSpline(x,y,0,0,true);
end else;
end else;
end else;
end;

procedure mine;
begin
if not (getcolor(411, 603) = 13408665) then
begin
check_water;
//check_food;
check_statima;
ClickMouseSpline(388, 223,0,0,false);
while not(IsTextInAreaEx(4, 65, 800, 470, x, y, 'this?', 0, Chars, False, False, 0, 1, $FFFFFF))  do
begin
wait(random(750));
end;
if(IsTextInAreaEx(4, 65, 800, 470, x, y, 'Mining', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
MoveMouseSpline(x,y,0,0);
wait(random(750));
if(IsTextInAreaEx(4, 65, 800, 470, x, y, 'Mine', 0, Chars, False, False, 0, 1, $FFFFFF)) then
begin
ClickMouseSpline(x, y, 0, 0, true);
check_break;
check_pickaxe;
wait(random(750));
if(getcolor(411, 603) = 13408665) then
begin
timesmined:=timesmined+1
reporttime:=reporttime+1
end else;
end else;
end else;
end else;
end;

procedure report;
begin
if(reporttime>10) then
begin
reporttime:=0
AddToReport('Number of times mined ' + IntToStr(timesmined))
end else;
end;

begin
setup;
ActivateClient;
repeat
mine;
check_pickaxe;
wait(random(750));
report;
until(false)
end.