SRL Archive - Help and Support

Script never ending


bibi26

2006-09-26 19:01:51

Hi,

I continue to make bibi26's powerminer but I have a problem : I have added the multilogin, all work great. When all actives players are on false, the script log out and do not try to re-connect but the script stay on "Running script…". It really annoy me, how can I make a condition that look if all player are false, if it true, then it exit the script.

Here is the main looping :
begin
SetupSRL;
SetupSRLMining;
ActivateClient;
DisguiseScar('Winamp');
DeclarePlayers;
Setvariables;
NickNameBmp:=CreateBitmapMaskFromText(Nickname,UpChars);
MouseSpeed := 10+random(2);
if not FindPickHeadColor then exit;
repeat
repeat
mineore;
dropore;
until (LoadsD = Loads);
ProgressReport;
wait(1000+random(500));
NextPlayer(true);
FreeBitMap(NickNameBmp);
Setvariables;
NickNameBmp:=CreateBitmapMaskFromText(Nickname,UpChars);
if not FindPickHeadColor then exit;
until (false);
end.

Thanks for further answer,
bibi26

WhiteShadow

2006-09-26 19:15:36

It's all about this section in NextPlayer

{*******************************************************************************
procedure NextPlayer(Active: Boolean);
By: Dankness
Description:
*******************************************************************************}

This section.

while Players[CurrentPlayer].Active = False do
begin
CurrentPlayer := CurrentPlayer + 1;
if CurrentPlayer > HowManyPlayers - 1 then
begin
CurrentPlayer := 0;
Wait(10000); // Everybody False. Endless Loop.
end;
end;

So instead of Wait(10000);

Just put TerminateScript or something. Maybe we could ask a developer to add a constant or just a param to NextPlayer to terminatescript when all players false. But not terminating a script really isn't anything of a problem. All it does it keep waiting. Your computer should go on standby or screen saver or whatever.

You can also try something like this :

procedure iExist;
var
i, Fc : Integer;
begin
for i:= 0 to HowManyPlayers - 1 do //for i is 0 to Number of players
begin
if(Players[i].Active = False)then
Fc:= Fc + 1;//if a player is false add 1 to counter
end;
if(Fc >= HowManyPlayers)then// if counter is equal to the amount of players
TerminateScript;
end;

I just quickly wrote it, but you get the idea.

bibi26

2006-09-26 19:26:24

Okay, I just find that annoying, but it just a wait, i'll maybe modifiy the wait for a terminatescript.

Thanks :)