SRL Archive - SRL Archives

SwitchWorld()


MasterKill

2009-04-01 09:51:02

N1ke! said the current one is not working, and I needed one, so I made this:

{*******************************************************************************
Function SwitchWorld(World: Integer): Boolean;
by: MasterKill
Description: Switches to the specified world. Returns true if successful.
*******************************************************************************}

const
HowManyWorlds = 169;

Function SwitchWorld(World: Integer): Boolean;
Var
x, y, c, s, t: Integer;
Logged: Boolean;
Top: Extended;
Begin
If LoggedIn Then
Begin
Logged := True;
Logout;
End;
c := DTMFromString('78DA63DCC1C4C0E0C680021EECA862F80FA41' +
'981F83F1030AE01AAB16240038C48249006A90920A0E630916A08' +
'D9B517D3CD186A3601D5B8125003F2BB030135DB816ABCF1AB010' +
'06A20101E');
If Not FindDTM(c, x, y, 677, 51, 712, 84) Then
Mouse(RandomRange(350, 409), RandomRange(240, 251), 0, 0, True);
t := GetSystemTime;
While Not FindTextTpaEx(16777215, 0, 57, 130, 162, 458, x, y, 'orld', SmallChars, Nothing) Do
If (T - GetSystemTime > 30000) Then
Begin
FreeDTM(c);
srl_Warn('SwitchWorld', 'Could not detect the worldlist', warn_AllVersions);
Exit;
End Else
Wait(500);
If FindTextTpaEx(16777215, 0, 57, 130, 162, 458, x, y, 'orld '+inttostr(World), SmallChars, Nothing) Then
Begin
Mouse(x, y, 0, 0, True);
Result := True;
End Else
Begin
x := 695 + random(4);
y := 159 + random(4);
MMouse(x, y, 0, 0);
HoldMouse(x, y, True);
Top := World / HowManyWorlds * 312;
s := MouseSpeed;
MouseSpeed := Round(MouseSpeed / 4);
MMouse(695 + random(4), 137 + round(Top), 0, 0);
ReleaseMouse(0, 0, True);
MouseSpeed := s;
SleepAndMoveMouse(RandomRange(300, 600));
Result := FindTextTpaEx(16777215, 0, 57, 130, 162, 458, x, y, 'orld '+inttostr(World), SmallChars, Nothing);
If Result Then
Mouse(RandomRange(86, 680), y, 0, 0, True);
End;
If Not Result Then
Begin
srl_Warn('SwitchWorld', 'Could not find the world you selected', warn_AllVersions);
If FindDTM(c, x, y, 677, 51, 712, 84) Then
Mouse(x, y, 5, 5, True);
End;
FreeDTM(c);
If Logged Then LoginPlayer;
End;

I hope it's usefull.

E: oh btw, I got the get text part from the old one, idk who I have to credit for that :p

ZephyrsFury

2009-04-01 10:13:05

The current one is working. You just need the latest Worlds.ini from FAWGOnline: http://freddy1990.com/fawg-online.php?action=show&id=1

Narcle

2009-04-01 10:47:03

I did the latest world switcher… you must have the correct ini file which the correct one has NEVER been placed in the Public SRL which I asked for 2-3 releases ago.

Also a small fix to it has been done in the Dev SRL which isn't in public yet.

MasterKill

2009-04-01 11:50:41

From: Narcle
I did the latest world switcher… you must have the correct ini file which the correct one has NEVER been placed in the Public SRL which I asked for 2-3 releases ago.

Also a small fix to it has been done in the Dev SRL which isn't in public yet.


Though, this doesn't need an ini wish get out of date.

Idk what is in the dev one :p but hey, 1 function ftw? :p