Runescapian321
2009-06-20 00:22:25
Well I have SRL do ChangeWorld(RandomWorld(Members, false));. Usually it works fine, but this has happened twice now
Both times with world 127. It scrolls as far as 126 then says that it failed to find 127.
I'm not sure what's wrong (To be honest I just cbf to wrap my brain around this ub3r complex dev code :D), here's the code:
Failed to find World 127!
Both times with world 127. It scrolls as far as 126 then says that it failed to find 127.
I'm not sure what's wrong (To be honest I just cbf to wrap my brain around this ub3r complex dev code :D), here's the code:
{*******************************************************************************
Function SelectWorld(W: Integer): Boolean;
by: Narcle & ZephyrsFury
Description: Switches to the specified world. Returns true if successful.
*******************************************************************************}
function SelectWorld(W: integer): boolean;
var
x, y, xx, yy, T: integer;
WRec: TWorld;
begin
SRL_Warn('WorldSwitcher.scar', 'WorldSwitcher.scar has been moved from Misc to Core. Scripters please un-include /misc/WorldSwitcher.scar', 34);
if OpenWorldScreen then
begin
wait(400+random(200));
if FindWorld(W) then
begin
wait(100+random(100));
if GetWorldInfo(W, WRec) then
begin
Writeln('World: '+inttostr(WRec.Number)+', Players: '+inttostr(WRec.PlayerNo)+', Members: '+Booltostr(WRec.Members)+', PvP: '+Booltostr(WRec.PVP));
If FindTextTpaEx(16777215, 0, 57, 130, 162, 458, x, y, 'orld '+inttostr(W)+' ', SmallChars, nothing) then
begin
MMouse(x, y, 500, 4);
GetMousePos(x, y);
wait(300);
if FindColor(xx, yy, 4351095, x-20, y-2, x+20, y+2) then
begin
Mouse(x, y, 0, 0, true);//Final click
T := GetSystemTime;
while (WorldScreen) and (GetSystemTime - T < 10000) do
Wait(100);
Result := (not(WorldScreen));
end;
end;
end else
WriteLn('World ' + IntToStr(W) + ' is either OFFLINE or FULL.');
end else
WriteLn('Failed to find World ' + IntToStr(W) + '!');
if (not(Result)) then TypeByte(vk_Escape);
end;
end;
{*******************************************************************************
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, l: integer;
wArray: TWorldArray;
begin
if Length(WorldArray) < 1 then
LoadWorldArrays;
H := High(WorldArray);
SetLength(wArray, H + 1);
for i := 0 to H do
if (WorldArray[i].Members = Members) and (WorldArray[i].PvP = PvP) then
begin
wArray[l] := WorldArray[i];
Inc(l);
end;
Result := wArray[random(l)].Number;
end;
{*******************************************************************************
function ChangeWorld(W: Integer): Boolean;
by: Nava2
Description: Changes to world W. Returns True if successful.
*******************************************************************************}
function ChangeWorld(W: Integer): Boolean;
begin
while LoggedIn do LogOut;
Result := SelectWorld(W);
LoginPlayer;
end;