SRL Archive - OSR Help

doesnt change world


Feroc1ty

2011-02-23 02:14:45

function TooCrowded():boolean;
var people:TPlayerArray;
begin
people := GetAllPlayers;
if high(people) >= MAX_PLAYERS then result := true;
fDebug('Main','Amount of players found: ' + tostr(high(people))+'.');
end;

procedure CheckWorld;
begin
if TooCrowded then
begin
while not LobbyScreen do
begin
if LoggedIn then
Logout
else
LoginPlayerToLob;
end;
ChangeWorld(RandomWorld(CLIENT_MEMBERS,false));
LoginPlayer;
end;
end;

It clicks "World Select" tab on player lobby, but then gets stuck there.

Echo_

2011-02-25 13:31:46

The problem with your snippet is that the RandomWorld function can return a world that isn't visible on your screen, therefore it just sits on the worlds tab. I wrote this up quickly as an example of what yours should do:
procedure CheckWorld;
var
CurW: Integer;
begin
if TooCrowded then
begin
ExitToLobby;
OpenWorldScreen;
if (WorldScreen) then
begin
WS_CurrentWorld(CurW);
SelectWorld(RandomRange((CurW+5), (CurW-5)));
LoginPlayer;
end else Exit;
end;
end;

It randomly chooses a world within 5 integers of your current world. It needs editing to choose a world with the right standards (ie MEMBERS, PVP).

Nava2

2011-02-25 14:18:14

SelectWorld should adjust to this.

Might be a bug in the procedure.

Wanted

2011-02-25 14:21:32

Don't do it like this.

Find the world you want and put it in WorldInfo[Members, WorldNo] and LoginPlayer will do it for you.

Bobzilla69

2011-02-25 15:03:02

function TooCrowded():boolean;
var people:TPlayerArray;
begin
people := GetAllPlayers;
if high(people) >= MAX_PLAYERS then result := true;
fDebug('Main','Amount of players found: ' + tostr(high(people))+'.');
end;

procedure CheckWorld;
begin
if TooCrowded then
begin
while not LobbyScreen do
begin
if LoggedIn then
Logout
else
LoginPlayerToLob;
end;
SelectWorld(RandomWorld(CLIENT_MEMBERS,false)); //here <------
LoginPlayer;
end;
end;

that would work

Echo_

2011-02-25 15:53:02

From: Nava2
SelectWorld should adjust to this.

Might be a bug in the procedure.


Or make the FindWorld function output the world it randomly chose so that you can then use it in the SelectWorld function.

Feroc1ty

2011-02-25 18:15:05

From: Bobzilla69
code

that would work


Did the same thing again, I think it's because the world isn't on the screen like someone previously mentioned, but I personally think it should scroll through the world tab until it finds it.

Bobzilla69

2011-02-26 04:11:34

well mine does scroll down and thats how i do it :(

ahh you logout all the way, i only logout to the lobby screen :)

procedure CheckOthers; //checks how many other people are here and leaves if over number
var
i:integer;
begin
i:= high(GetAllPlayers);
if (i > Players[CurrentPlayer].Integers[15])then
begin
Write('To many players on Minimap switching worlds');
Wait(10500+Random(3500)); //waits ten seconds needed to insure it loggs out
ExitToLobby;
Wait(800+Random(800));
SelectWorld(RandomWorld(Players[CurrentPlayer].WorldInfo[0], Players[CurrentPlayer].WorldInfo[2] )); //both false
LoginPlayer;
end;
end;


here is how i switch worlds based on number of players around me.

Feroc1ty

2011-02-26 14:13:52

From: Bobzilla69
well mine does scroll down and thats how i do it :(

ahh you logout all the way, i only logout to the lobby screen :)

procedure CheckOthers; //checks how many other people are here and leaves if over number
var
i:integer;
begin
i:= high(GetAllPlayers);
if (i > Players[CurrentPlayer].Integers[15])then
begin
Write('To many players on Minimap switching worlds');
Wait(10500+Random(3500)); //waits ten seconds needed to insure it loggs out
ExitToLobby;
Wait(800+Random(800));
SelectWorld(RandomWorld(Players[CurrentPlayer].WorldInfo[0], Players[CurrentPlayer].WorldInfo[2] )); //both false
LoginPlayer;
end;
end;


here is how i switch worlds based on number of players around me.


I have a similar function but it still gets stuck, I updated SRL this morning to see if that would help but now my script doesn't even work to test if it functions now, will post again when I got my script working to see if updating SRL helped (so far it made it worse since my script broke LOL)