Code:
function SelectWorld(W: integer): boolean;
var
i,t: integer;
validworld : boolean;
worldbox: tbox;
begin
result := currentworldls = w;
if result then
exit;
if Length(WorldArray) < 1 then
worldarray :=
[301,320,341,360,+
302,321,342,361,+
303,322,343,362,+
304,325,344,365,+
305,326,345,366,+
306,327,346,367,+
309,328,349,368,+
310,329,350,369,+
311,330,351,370,+
312,333,352,373,+
313,334,353,374,+
314,335,354,375,+
317,336,357,376,+
318,337,358,377,+
319,338,359,378];
for i:=0 to high(worldarray) do
begin
if worldarray[i]=W then
begin
arraynumber := i;
validworld := true;
break;
end
end;
if not validworld then
begin
srl_Warn('SelectWorld', 'Invalid World', warn_AllVersions);
ExitWorldScreen;
Exit;
end;
if OpenWorldScreen then
begin
worldbox:= FindWorld(I);
if worldbox.x1 = 0 then
begin
ExitWorldScreen;
exit;
end;
mousebox(worldbox.x1,worldbox.y1,worldbox.x2,worldbox.y2,mouse_left);
result:=true;
end;
marktime(t);
repeat
wait(randomrange(400,500));
if timefrommark(t)>6000 then
begin
ExitWorldScreen;
exit;
end;
until not worldscreen;
wait(randomrange(400,500));
if (not(Result)) then TypeByte(vk_Escape);
end;
But anyways I was thinking that I could use it as a function, write another one that would compensate for the the jump (+3/+4 instead of +1/+2). But then I have no idea how I would write a new world hopper that would differentiate between which one it would call. Like I've tried setting it up as a case, but it wouldn't work.