SRL Archive - SRL Archives

VERY small Magic.scar fix..


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..

Harry

2008-08-18 17:27:36

Why do you gotta make so many improvements to SRL? :p

Nice work though, glad you contribute lots of fixes almost every day <3

EvilChicken!

2008-08-18 17:36:33

From: Hy71194
Why do you gotta make so many improvements to SRL? :p

Nice work though, glad you contribute lots of fixes almost every day <3


Wow, fast response.
iSpy FTW?

You think I should stop?
(It's not for postcount, I was planning to delete this thread once I got some response regarding the actual function, even before I posted the thread.)

Edit; Every day? Ehm, you saw what happened the last time I tried. I've been kinda cautious after that.


Muy importante; can someone test this in a repeat loop? (With JustCheck set to On) I did test it, but you never can be too sure.


Edit2: Harryyy.. You know I .. Ehm, loveee you, riiiiight?
Test it for me please? :rolleyes:

Harry

2008-08-18 17:40:32

Yes, iSpy is my drug :(

And you seem to be the most poster in this subforum, that's why I said it ;)

EvilChicken!

2008-08-19 19:10:12

Anyone tested it yet?

Nava2

2008-08-20 08:27:01

  MouseBox(625, 413, 658, 448, 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);

Decrease the wait to maybe… (200 + random(300)) ? Makes it faster, and more realistic.

EvilChicken!

2008-08-20 10:24:21

Thanks for looking at it, Nava2, but it is supposed to be that way.
I'm not trying to double-click the SetRun, the wait is intended. Try it.

UPDATED FOR NEW SETRUN, MUCH BETTER NOW!
Also posted as a whole script, so you just can copy-paste to test.

Nava2

2008-08-20 11:12:59

From: EvilChicken!
Thanks for looking at it, Nava2, but it is supposed to be that way.
I'm not trying to double-click the SetRun, the wait is intended. Try it.

UPDATED FOR NEW SETRUN, MUCH BETTER NOW!
Also posted as a whole script, so you just can copy-paste to test.


Okay :).

Btw, what does StrToIntDef do?

EvilChicken!

2008-08-21 01:19:14

StrToIntDef is just basically this:

function StrToIntDef(Str: string; Def: LongInt): LongInt;
begin
try
Result := StrToInt(Str);
except
Result := Def;
end;
end;
(Might be slightly different, but I just wrote this as an example..)
Nothing complicated.
Did you test it?

Nava2

2008-08-21 17:21:12

From: EvilChicken!
StrToIntDef is just basically this:

function StrToIntDef(Str: string; Def: LongInt): LongInt;
begin
try
Result := StrToInt(Str);
except
Result := Def;
end;
end;
(Might be slightly different, but I just wrote this as an example..)
Nothing complicated.
Did you test it?


Thanks, I don't have SCAR atm… :(