SRL Archive - Help and Support

Multiple accounts.


Junior

2006-11-21 18:28:18

Okay I never knew much about this. All I know what to do is make a whole list with declare players and stuff. But how do you make them switch from player to player after there task or limit has been reached in a script? And "Break;" is just a simple wait isn't it?
Thanks for the help.
~jR

Yakman

2006-11-21 18:37:45

use the SRL procedure NextPlayer(active:boolean);

if active is true, the current players active will stay true, it will return to auto more

if active is false, the current players active be be false, it is removed from the queue and will never auto again until a human comes and resets it


break; is a way of breaking out of a loop;

repeat
if(FindColor(x,y,255,2,23,234,345))then.
begin
//..
//..
//..
end
until(IsUpText('mine'));

if we used the procedure Break; inside the loop, it would imideatly jump out of the loop

repeat
if(not LoggedIn)then Break; //this makes the script jump all the way there
if(FindColor(x,y,255,2,23,234,345))then.
begin.

//..
//..
//..

end

until(IsUpText('mine'));
//this makes the script jump all the way here

Bam Bam

2006-11-21 18:53:39

From: Junior
Okay I never knew much about this. All I know what to do is make a whole list with declare players and stuff. But how do you make them switch from player to player after there task or limit has been reached in a script? And "Break;" is just a simple wait isn't it?
Thanks for the help.
~jR


Ok first off

you use if loggedin then nextplayer(true); to switch players

Break; may seem like a wait to a beginning scripter but only works when in a loop and simply tells SCAR to stop looping and move on to the next action of the script where in contrast wait(1000); would really pause the script for one second then continue working and does not skip over any actions the way break; would

Example:
program New;

procedure TestWait;
var
i: integer;
begin
Writeln('procedure TestWait; will write "hello world"');
Writeln('to the debug box 3 times one second apart using');
Writeln('wait;');
repeat
Writeln('Hello World');
i := i + 1;
wait(1000);
until(i >= 3);
end;

procedure TestBreak;
var
i: integer;
begin
Writeln('procedure TestBreak; breaks out of the loop ');
Writeln('before writing "Hello World" three times');
repeat
break;
Writeln('Hello World');
i := i + 1;
wait(1000);
until(i >= 3);
end;

begin
cleardebug;
TestWait;
cleardebug;
TestBreak;
end.

Edit: Damn Yakman you beat me :P

Junior

2006-11-21 21:07:18

Ok thanks guys now I really understand what Break; means. And more thing. Im going to make a main loop, just a simple one and tell me if im right on what it does.


Begin
SetUpSRL;
DeclarePlayers;
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
If (Not(LoggedIn))Then
LogginPlayer;
If(LoggedIn)Then
Begin
Walk;
Repeat
Break;
Run;
Until(Run >= RunTime)
If(Run >= RunTime) Then
Begin
Progress;
Logout;
NextPlayer(True);
End;
End;
End.

Ok, I just made this off the top of my head. Now Is this going to :
If the player isnt logged then log him in, and if he is logged, he will walk. When the walk procedure is done, he will run until he is over or equal to his running time. Now The break in the repeat loop quickly stops the procedure from repeating itself if, again, he is over or equal to his running time. And after, again, he is over or equal to his running time, he will logout, and then loggin the next player?
I had a problem on NextPlayer(True);, im not really sure about that.

tarajunky

2006-11-21 23:28:19

With that script, your character will NEVER run. You enter the Repeat loop and then immediately abort the loop with Break. Break skips run, and skips the Until condition check and goes directly to your If Run > Runtime then begin line.

Of course, since you never did run, you won't meet the Run > Runtime condition so you won't enter that section.

So, you'll Login, you'll Walk, but there will be no Run, no Progress, no NextPlayer…

Junior

2006-11-22 00:27:02

Ok Thank you everyone for helping me out on this!

da_professa

2006-11-22 01:20:52

just a small question relating this topic.. Didn't want to start a new topic.. Is there a tutorial on multiplayers.. I remember one from fawaki but can't seem to find it..

Bam Bam

2006-11-23 12:06:37

From: da_professa
just a small question relating this topic.. Didn't want to start a new topic.. Is there a tutorial on multiplayers.. I remember one from fawaki but can't seem to find it..


I think there is an example located inside the SRL hep file