If you want here is some code from my cooker:
It work practically flawlessly… no problems with it so far. Fell free to use/edit if you want.
You would have to declare the points:
ToKitchen[3] := Point(3205, 3208); //Point1 On The Staircase
ToKitchen[4] := Point(3205, 3207); //Point2 On The Staircase
and use this (WaitUntil) or replace it with repeat – until's:
Function WaitUntil(Time: Integer; Condition: Boolean): Boolean;
var
Timer: Integer;
begin
Result := False;
MarkTime(Timer);
while (not(Condition)) and (TimeFromMark(Timer) <= Time) do
begin
Wait(RandomRange(30,70));
end;
if (TimeFromMark(Timer) >= Time) then
begin
Result := False;
Exit;
end;
if (Condition) then
Result := True
else
Result := False;
end;
function MouseStaircase(Click: Boolean): Boolean;
var
MoveCounter, ClickCounter: Integer;
Clicked: Boolean;
Sc1, Sc2: TPoint;
begin
if not (LoggedIn) then
Exit;
ClickCounter := 0;
repeat
if (IsIdle) then
begin
MoveCounter := 0;
AntiRandoms;
repeat
SetAngle(True);
if (MoveCounter >= 5) then
begin
Sc1 := Sc2;
end
else
begin
Sc1 := TileToMS(ToKitchen[3], 0);
Sc2 := TileToMs(ToKitchen[4], 0);
end;
if IsMenuOpen then
MouseBox(MSX1, MSY1, MSX2, MSCY, 3);
Inc(MoveCounter);
WriteLn('Staircase Uptext Attempt ' + IntToStr(MoveCounter) + '.');
MMouse(Sc1.x, Sc1.y, RandomRange(-5,2), RandomRange(-5,2));
WriteLn('Moved The Mouse Over The Staircase.');
until R_WaitUpText('staircase',500 + Random(300)) or (MoveCounter >= 10);
begin
if (MoveCounter >= 10) then
Writeln('Unable To Get The Correct Bottom Floor Staircase Uptext Using Sc1 and Sc2.')
else
begin
ClickMouse2(Click);
if (Click = True) then
begin
if WaitUntil(500, DidRedClick) then
Clicked := True
else
Inc(ClickCounter);
end
else
begin
if WaitUntil(500, IsMenuOpen) then
Clicked := True
else
Inc(ClickCounter);
end;
end;
end;
end
else
begin
Continue;
end;
until (Clicked = True) or (ClickCounter >= 5);
if (ClickCounter >= 5) then
begin
Writeln('Function MouseStaircase is False.');
Result := False;
end
else
Writeln('Function MouseStaircase is True.');
Result := True;
end;
Procedure StaircaseTo(Route: String);
var
Counter1, Counter2, Counter3, GoalFloor, OppositeFloor, MidFloor: Integer;
begin
if not (LoggedIn) then
Exit;
WriteLn('Running StaircaseTo(' + Route + ').');
MidFloor := 1;
if (Route = 'Up') then
begin
GoalFloor := 2;
OppositeFloor := 0;
end
else if (Route = 'Down') then
begin
GoalFloor := 0;
OppositeFloor := 2;
end;
case GetPlaneIndex of
GoalFloor: Writeln('Already On The ' + Route + ' Floor.');
OppositeFloor:
begin
Counter1 := 0;
if (MouseStaircase(True)) then
begin
repeat
Inc(Counter1);
Writeln('Counter1 Is ' + IntToStr(Counter1) + '.');
if WaitUntil(3000, (GetPlaneIndex = 1) or (GetPlaneIndex = GoalFloor)) then
StaircaseTo(Route)
else if (GetPlaneIndex = GoalFloor) then
Break
else if (GetPlaneIndex = MidFloor) then
StaircaseTo(Route);
until (Counter1 >= 5) or (GetPlaneIndex = GoalFloor);
begin
if (Counter1 >= 5) then
EndScript('Could Not Get To The ' + Route + ' Floor.')
else
WriteLn('Successfully Reached The ' + Route + ' Floor.');
end;
end
else
EndScript('MouseStaircase Is False');
end;
MidFloor:
begin
Counter1 := 0;
Counter2 := 0;
Counter3 := 0;
WriteLn('On The Middle Floor Continuing.');
repeat
Inc(Counter2);
WriteLn('Counter2 Equals ' + IntToStr(Counter2) + '.');
if (MouseStaircase(False)) then
begin
repeat
Inc(Counter1);
R_ChooseOption(Route);
until (DidRedClick) or (Counter1 >= 20);
if not (Counter1 >= 20) then
begin
WriteLn('Clicked On Option ' + Route + '.');
if (not (WaitUntil(3000, (GetPlaneIndex = GoalFloor)))) then
EndScript('Somehow Failed To Get To GoalFloor.');
end
else
WriteLn('Counter1 Is ' + IntToStr(Counter1) + '. Unable To Go To Choose An Option. Will Try Again.');
end
else
Writeln('MouseStaircase Is False.');
until (GetPlaneIndex = GoalFloor) or (Counter2 >=10);
if (Counter2 >= 10) then
EndScript('Counter2 Equals ' + IntToStr(Counter2) + '. Unable To Go To The ' + Route + ' Floor.');
end;
end;
end;
BTW, Endscript is the procedure i call to end my script or current player.