EvilChicken!
2008-08-18 17:26:14
program New;
{.include SRL/SRL.scar}
{.include SRL/SRL/SKILL/Magic.scar}
function GetLumbridgeMinsEx(JustCheck: Boolean): Integer;
var
X, Y, MagicMark: Integer;
begin
Result := 0; // Or -1, I can't really decide. But I think 0 would be conciderably better.
if not LoggedIn then exit;
if not GetCurrentTab <> 7 then
begin
if not GameTab(7) then exit;
Wait(750 + Random(750));
end;
if not Cast('1') then exit; // AHIHI.
MagicMark := GetSystemTime;
repeat
if Pos('another', GetBlackChatMessage) > 0 then
begin
Result := StrToIntDef(Trim(Between('another', 'minutes', GetBlackChatMessage)), -1); // HERE I think -1 would be better to use as a default, but that is up to You.
Exit;
end;
Wait(50 + Random(250));
until (TimeFromMark(MagicMark) <= 4000);
if not JustCheck then exit;
MouseBox(719, 102, 758, 117, 1); // Coords taken from SetRun.
Wait(500 + Random(750)); // Change run state to interrupt home teleport.
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True); // Set run state back to original state.
end;
begin
SetUpSRL;
ActivateClient;
Wait(500 + Random(750));
Disguise('LOLS');
WriteLn(IntToStr(GetLumbridgeMinsEx(True)));
Disguise('Done');
end.
The JustCheck boolean is to whether abort if Result = 0 or not. (If set to true, then it clicks the Run thingy (don't know what to call it, it's like SetRun..) twice, to abort home teleport. This is a much smarter alternative to coordinate-clicking (current function has a randomness of 2 whole pixels..) the MM and moving the char. And, it clicks the run thingy twice to preserve the current run setting that is on the char.
The TryExceptEnd was killing me, (StrToIntDef), so if you decide not to commit this, (which I would fully understand :p) at least change that unless there is a difference between TryExcept and StrToIntDef. (In this relation. =.=`)
Excuse my standards, and please post any feedback/questions you have.
I just hope I don't mess up anything this time.
Edit: I'm starting to believe more and more that the Default in StrToInTDef(…, 0) should be changed to -1. Because,
"if GetLumbridgeMinutes(False) <> 0 then exit" or something like that would work better than if the default was 0, since 0 kinda equals lumby tele.
Bah, I suck at explaining, but people should still understand, right?
Anyway, I'll change the default to -1, please comment if that's the right thing to do..