SRL Archive - SRL Suggestions

Random World Procedure


Gearsnare

2009-03-27 21:52:32

There should be a procedure that randomly chooses a random world from either non-members, members or both. This could then be run before a new player logs in, this way there will be no more people reporting macroing who watch 5 players log in and out after long periods of silence.

The procedure could reload SMART altogether or just change the world from inside the client.

I'd try to make but I'm struggling to make my first script and don't want to tackle something like this yet.

Feedback?

BKNYKavkaz

2009-03-27 22:03:16

{*******************************************************************************
function RandomWorld(Members, PvP: Boolean): Integer;
by: Narcle & mixster
Description: Returns a random world by paramaters.
*******************************************************************************}
function RandomWorld(Members, PvP: Boolean): Integer;
var
i, H: integer;
wArray: TWorldArray;
begin
if Length(WorldArray) < 1 then
LoadWorldArrays;
H := High(WorldArray);
for i := 0 to H do
if (WorldArray[i].Members = Members) and (WorldArray[i].PvP = PvP) then
begin
SetArrayLength(wArray, Length(wArray)+1);
wArray[High(wArray)] := WorldArray[i];
end;
Result := wArray[random(High(wArray)+1)].Number;
end;