SRL Archive - SRL Archives

function Loading: Boolean;


JAD

2007-06-26 19:13:49


program New;
{.include SRL/SRL.scar}

function Loading: Boolean;
var TPA: TPointArray;
LoadingTime: Integer;
begin
if(not(LoggedIn))then
Exit;
if(not(GetColor(114,32) = 0))then
begin
Result := False;
Exit;
end;
FindColorsSpiralTolerance(x,y,TPA,0,7,7,204,34,0);
Result := GetArrayLength(TPA) = 5291;
end;



begin
ActivateClient;
wait(1000+random(500));
repeat
wait(1);
until(Loading);
MarkTime(LoadingTime);
repeat
wait(1);
until(not(Loading));
Writeln('took ' + IntToStr(TimeFromMark(LoadingTime)) + ' Milliseconds to stop loading');
end.

:) Run the script and then while it's running keep walking on the map for about 15 seconds until you see the loading - please wait thing, it works perfectly for me :) I mark timed it and it took 0 milliseconds for the Loading procedure to check :p

Buckleyindahouse

2007-06-26 20:00:40

What could this be used for?

shaunthasheep

2007-06-26 20:25:21

From: JAD

I mark timed it and it took 0 milliseconds for the Loading procedure to check :p


Hows that possible? You have

  repeat
wait(1);
until(not(Loading));

No matter what it's going to wait 1 millisecond xD

And will this work on unsigned?

JAD

2007-06-26 20:27:03

From: Buckleyindahouse
What could this be used for?


While you are waiting for that flag to be gone, or waiting to be within distance or whatever of the flag, you could do something like this in it:


function MyFlag;
var LoadTime: Integer;
begin
repeat
wait(100);
if(Loading)then
begin
MarkTime(LoadTime);
repeat
wait(10);
until(not(Loading)) or (TimeFromMark(LoadingTime) > 6000);
if(TimeFromMark(LoadingTime) > 6000)then
begin
Writeln('You are laggin WAY to much.. Possibly a connection problem? Switching players..');
LogOut;
Players[CurrentPlayer].Loc = 'LostConnection';
Result := False;
Exit;
end;
until(not(FlagPresent));
end;

See? :) Not the most useful thing I guess.. But I just thought I'd make it in case somebody had use for it. So it could be pretty useful there :)

or, if you are waiting for the flag to be gone and mark timing how long it takes for the flag to be gone, you could do this:


procedure Whatever;
var Timing, LoadingTime, TheTime: Integer;
begin
RadialWalk(......);
MarkTime(LoadingTime);
repeat
wait(100);
if(Loading)then
begin
MarkTime(Timing);
repeat
wait(10);
until(not(Loading));
TheTime := TimeFromMark(Timing);
until(FlagDistance < 3);
TimeFromMark(LoadingTime) := TimeFromMark(LoadingTime) - TheTime;
Writeln('took ' + IntToStr(TheTime) + ' for flag to be within a 2 pixel distance');
end;

See? :) So it could be useful for a few things I guess..


Edit: @The RS Monkey, I don't know, didn't try on unsigned applet. And I said


I mark timed it and it took 0 milliseconds for the Loading procedure to check


It took 0 milliseconds for it to check if we were loading :p

Rune Hacker

2007-06-26 21:30:41

I dont think this really needs to be incorperated with the flag thing because its not like loading messes up the flag. It is a cool procedure that could be useful, but i dont see how it can be used effectively lol.

JAD

2007-06-26 21:56:01

From: Rune Hacker
I dont think this really needs to be incorperated with the flag thing because its not like loading messes up the flag. It is a cool procedure that could be useful, but i dont see how it can be used effectively lol.


There's probably a way… :p It could be used when mining, if it's loading while your mining, you can not count that time or whatever.

I never said it was the most useful function ever, but there wasn't one for it, and it wasn't the least useful function ever either :p

Anyways, thanks :)

mastaraymond

2007-06-28 03:16:34

[PHP]Function IsLoading:Boolean;
Begin;
If (GetColor(6, 35) = 16777215) and (GetColor(7,34) = 0) then Result:=true;
end;[/PHP]

Shorter ^^. Just do While IsLoading do
wait(20)

Pentti

2007-06-28 05:42:50

includes\SRL\SRL\misc\Loading.scar.
i needed stuff like that for my multi city miner when walking, or else it will mess up, in my script I used something like that:
procedure ScreenLoading;
var
LoadingSafeMark:Integer;
begin
if(FindColor(x,y,0,180,115,320,180))and
FindColorTolerance(x,y,16777215,180,115,320,180,3)then
begin
MarkTime(LoadingSafeMark)
GoingOn('Screen loading')
repeat
wait(300)
until(not(FindColor(x,y,0,180,115,320,180)))and
not(FindColorTolerance(x,y,16777215,180,115,320,180,3))
or(TimeFromMark(LoadingSafeMark)>=10000)
GoingOn('Screen loaded ['+inttostr(TimeFromMark(LoadingSafeMark))+'ms]')
end;
end;

XcanadamanX

2007-06-28 10:57:51

From: Rune Hacker
I dont think this really needs to be incorperated with the flag thing because its not like loading messes up the flag. It is a cool procedure that could be useful, but i dont see how it can be used effectively lol.


have you ever used radialwalk and you lag at like exactly 10 pixels away from the flag? it totally screws up your proc because it tries to click the next part but since its loading it keeps clicking (mousefindflag). it totally messes every thing up. good job btw JAD

JAD

2007-06-28 11:19:37

From: XcanadamanX
have you ever used radialwalk and you lag at like exactly 10 pixels away from the flag? it totally screws up your proc because it tries to click the next part but since its loading it keeps clicking (mousefindflag). it totally messes every thing up. good job btw JAD


Thanks canada man :)

It could just be used (in MouseFindFlag) while Loading do wait(100); to not screw that up :)

XcanadamanX

2007-06-28 11:43:55

yep. i think it should be used in most funcs that wait for the flag.

Town

2007-06-28 15:45:24

Going up/down ladders.

JAD

2007-06-28 19:02:31

From: Town
Going up/down ladders.


exactly. So you don't try to radial walk or something while going up a ladder, and then the radial walking would fail because your still loading, making that player be lost! :)

Hugolord

2007-07-01 08:59:46

Gj Jad!

JAD

2007-07-01 10:06:40

From: hugolord
Gj Jad!


Thanks :)