From: Jason2gs
Sucks how it's only on unsigned :(
I guess jagex actually thought ahead :p
Correction - Only on
signedWell as non - members cant get to the official thread, ill post it here..
Well here it is:
function GetXY(World: integer; var x, y: Integer): Boolean;
var
column, row: integer;
begin
World := World - 1;
Row := World mod 20;
Column := trunc((World/20));
x := 137 + (Column * 93);
y := 42 + (Row * 23);
Result := True;
end;
function ArrangeWorlds(Arrow: Integer): Boolean;
var
Buttons: Array[1..8] of Integer;
begin
Buttons[1]:=283;
Buttons[2]:=298;
Buttons[3]:=393;
Buttons[4]:=408;
Buttons[5]:=503;
Buttons[6]:=518;
Buttons[7]:=613;
Buttons[8]:=628;
If(GetColor(Buttons[Arrow], 7) = 265388)then
begin
Mouse(Buttons[Arrow], 7, 3, 3, True);
ArrangeWorlds(Arrow);
end else
Result := True;
end;
function CheckFree(World: Integer): Boolean;
var
x, y: Integer;
begin
GetXY(World, x, y);
Result:= ((SimilarColors(GetColor(x, y), 14079702, 5))
or (SimilarColors(GetColor(x, y), 15395562, 5)));
end;
function ChooseWorld(World: integer): Boolean;
begin
GetXY(World, x, y);
Mouse((x - 74), (y - 5), 83, 14, True);
Result := True;
end;
function CheckOpenChooseWorld: Boolean;
begin
Result := ((GetColor(19, 58)=0) and (GetColor(641, 430)=0));
end;
function OpenChooseWorld: Boolean;
begin
if(CheckOpenChooseWorld) then
begin
Result := True;
Exit;
end
if(GetColor(718, 413) = 6055005) then
begin
Mouse(10, 465, 90, 30, True);
wait(1000+random(1000));
OpenChooseWorld;
end
end;
function ChooseFirst(Free: Boolean): Boolean;
var
i :integer;
begin
for i:= 1 to 100 do
begin
if(CheckFree(i)=Free) then
begin
ChooseWorld(i);
Result := True;
Exit;
end
end
end;
Contains lots of mini functions lol
How to use:
ArrangeWorlds - Clicks on one of the arrows specified, 1 being the first arrow, 8 being the last.
CheckFree - Checks if specified world is free.
ChooseWorld - Clicks on world
CheckOpenChooseWorld - Returns true if world select window is up
OpenChooseWorld - Opens world select window
ChooseFirst - Chooses the first member / free world on the list
With ChooseFirst you can arrange it by lowest players with ArrangeWorlds(4) then choose the first free world on the list. May work on this further but this is all im doing tonight.
By the way - This uses coordinates and colours - no text or bmps or anything… should be quicker.
BTW you will need to get the handle of the client every time you change worlds, it refreshes the page.
Example use:
OpenChooseWorld;
ArrangeWorlds(4);
ChooseFirst(True);
This opens change world screen, changes it to sort by lowest players if needed and selects the first free world from the list.
Anyone that got it before i edited, i made a typo… Get new version
Edit:
Added two more functions:
CheckFull - Returns true if world is full
ChooseFirstNotFull - Chooses first non full world
function CheckFull(World: Integer): Boolean;
var
x, y: integer;
begin
GetXY(World, x, y);
if((GetColor((x - 28), (y - 2))=16777215) and
(GetColor((x - 21), (y + 5))=16777215) and
(GetColor((x - 14), (y + 5))=16777215)) then
Result := True
end;
function ChooseFirstNotFull(Free: Boolean): Boolean;
var
i :integer;
begin
for i:= 1 to 100 do
begin
if((CheckFree(i)=Free) and (not CheckFull(i))) then
begin
ChooseWorld(i);
Result := True;
Exit;
end
end
end;
EDIT #3:
Added two new functions -
GetCountry - Gets country of world
ClickFirstCountry - Clicks the first on the list of the specified country
here they are:
function GetCountry(World: Integer): Integer;
var
FlagPos: Array[1..7] of Integer;
k: integer;
x, y: integer;
begin
GetXY(World, x, y);
k := GetColor((x - 43),(y - 5));
case k of
9777152: Result := 1;//Flag 1 blue cross
16711422: if(GetColor((x - 42),(y - 5)) = 253) then
Result := 5//Flag 5 Australia
else
Result := 2;//Flag 2 canada
52222: Result := 3;//Flag 3 yellow cross
5177858: Result := 4;//Flag 4 America
6424072: Result := 6;//Flag 6 england
1180111: Result := 7;//Flag 7 red white blue
end
end;
function ClickFirstCountry(Free, Full: boolean; Country: integer): Boolean;
var
i :integer;
begin
for i:= 1 to 100 do
begin
if((CheckFree(i)=Free) and (GetCountry(i)=Country)) then
begin
if(Full) then
begin
if(not CheckFull(i))then
begin
ChooseWorld(i);
Result := True; // =0 lots of nested ifs
Exit;
end
end else
begin
ChooseWorld(i);
Result := True; // =0 lots of nested ifs
Exit;
end
end
end
end;
BTW these havent been tested very much, but i assume they will work.
Oh yeah - I added the country ones because i thought there could be a global variable or something of the country they would most like to go into to reduce lag or whatever.. I know one of my friends comps always used to lag when he went into a non australian world. That way in the script you can make it go to the world in the country with the least players.
Click first country goes down the list, first checking if the world is free or members, then checking if the country matches the one specified, then if the boolean full is true it checks if the country is full.
Edit 4.. oops little bug