SRL Archive - OSR Help

Failsafe


Wetish

2012-01-10 16:39:00

How would I add a failsafe into this part of my script. I want to add one that would ensure that the script does not somehow miss click and fails to soften the clay.

function SoftenClay:Boolean;
Var
X, Y, Clay, SoftClay, Soft:Integer;

Begin
Clay := DTMFromString('mlwAAAHicY2dgYMhgZWDIBeJSIM4B4hQgTmWFiK9kZGCYC8RLgHg1EK8C4sVAvBCI+8r9gLqZsGJ+IMlIBoYCAAXECRc=');

If FindDTM(Clay, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
MMouse(X, Y, 3, 3);
wait(600 + random(400));
If IsUpText('lay') Then
Begin
Mouse(X, Y, 0, 0, True);
if FindColorSpiralTolerance(x, y, WellColor, MSX1, MSY1, MSX2, MSY2, 3) then
Begin
MMouse(X, Y, 3, 3);
wait(600 + random(400));
if(IsUpText('ell'))then
begin
Mouse(X, Y, 0, 0, True);
Wait(3000 + random(500));
MouseBox(236, 403, 280, 454, 1);

wait(2000 + random(20000));
MMouseItem(28);
MarkTime(Soft);
repeat
wait(500 + random(500));
if(IsUpText('oft')) then
Result := True Or
(TimeFromMark(Soft) > 30000);

until(Result);
end;
end;
end;
end;
end;

Also..
What are some failsafes that I could add to the rest of my script before releasing it. (Right now I very small amount)

Brandon

2012-01-10 16:44:10

Oohhh killed my eyes.. Standards need work:


function SoftenClay:Boolean;
Var
X, Y, Clay, SoftClay, Soft:Integer;

Begin
Clay := DTMFromString('mlwAAAHicY2dgYMhgZWDIBeJSIM4B4hQgTmWFiK9kZGCYC8RLgHg1EK8C4sVAvBCI+8r9gLqZsGJ+IMlIBoYCAAXECRc=');

If FindDTM(Clay, X, Y, MIX1, MIY1, MIX2, MIY2) Then
Begin
MMouse(X, Y, 3, 3);
wait(600 + random(400));

If IsUpText('lay') Then
Begin
Mouse(X, Y, 0, 0, True);
if FindColorSpiralTolerance(x, y, WellColor, MSX1, MSY1, MSX2, MSY2, 3) then
Begin
MMouse(X, Y, 3, 3);
wait(600 + random(400));
if(IsUpText('ell'))then
begin
Mouse(X, Y, 0, 0, True);
Wait(3000 + random(500));
MouseBox(236, 403, 280, 454, 1);

wait(2000 + random(20000));
MMouseItem(28);
MarkTime(Soft);
repeat
wait(500 + random(500));
if(IsUpText('oft')) then
Result := True Or
(TimeFromMark(Soft) > 30000);
until(Result);
end;
end;
end;
end;
end;

As for failsafes I think it's sorta the scripter's job to figure out what problems there can possibly be no?

YoHoJo

2012-01-10 16:46:22

Could you fix your standards and use Simba tags instead of code tags? Hard to read!

Basically after your ends (which correspond to the begins after finding something) put failsafe.

Ex:
If finddtm Then
Begin
DoStuff;
End Else
Begin
Writeln('could not find DTM!');
Logout;
End;

NexPB

2012-01-10 16:56:26

I think a good failsafe would be if it doesn't find the Wellcolor it could retry searching another color. if it still can't find any color log it out and stop script.

Wetish

2012-01-10 17:09:40

I think I should go through my whole script and make it look more eye appealing