SRL Archive - Reflection Development

ChangeWorldMark.


Dervish

2010-09-06 13:31:34

These procedures are one's i've made to make it so that you will not log into a world which is over populated where you will auto :

procedure MarkWorld;

var
MarkedWorlds : TIntegerArray;
CurrentWorld_ : Integer;

begin

MarkedWorlds[((high(MarkedWorlds))+1)] := CurrentWorld_;

end;

MarkWorld will make the world you are currently in Marked.

procedure ChangeWorldMark(mark: boolean;
amountofplayers : integer;
MemberWorld, PvPWorld : boolean);

var
MarkedWorlds : TIntegerArray;
CurrentWorld_, X: Integer;
GoodWorld : Boolean;

begin

If ((high(GetPlayers)) > amountofplayers) then
begin
Writeln('It would seem that there are too many players in this world.');
if (mark) then
MarkWorld;

repeat
CurrentWorld_ := RandomWorld(MemberWorld,PvPWorld);
for x:=0 to high(MarkedWorlds) do
begin
if (CurrentWorld_ = MarkedWorlds[x]) then
break;

GoodWorld := True;

end;
until(GoodWorld);

SelectWorld(CurrentWorld_);
LoginPlayer;
end;

end;

ChangeWorldMark changes the world to another one, with your settings :

Mark : mark the world using MarkWorld or not ?
amountofplayers : how many players to detect for it to change the world ?
MemberWorld : should it also consider member worlds to login to ?
PvPWorld : should it also consider PvPWorlds to login to ?

Using these would require to add :

  CurrentWorld_ := RandomWorld(MemberWorld,PvPWorld);
SelectWorld(CurrentWorld_);

Somewhere in the LoginPlayer; though so that there is a CurrentWorld_ marked.

TL;DR :

MarkWorld : marks the world you're in so that you won't log into it using ChangeMarkWorld.
ChangeMarkWorld : logs into a non marked world with your settings

Edit : needless to say these need reflection.

Cstrike

2010-09-06 13:43:54

Wow this would be VERY USEFUL for my rune miner, cause I'm stuck modifying the worldswitcher.scar to output player numbers.

Can I just call amountofplayers anywhere before hopping worlds and it will return the player # of whatever world is chosen?

Dervish

2010-09-06 14:01:55

From: cstrike
Wow this would be VERY USEFUL for my rune miner, cause I'm stuck modifying the worldswitcher.scar to output player numbers.

Can I just call amountofplayers anywhere before hopping worlds and it will return the player # of whatever world is chosen?


If you put say 0 for amountofplayers, if there is more than 0 players, then it will change world :p.

Reflection simplifies.