SRL Archive - SRL Archives

WorldMap.scar


Cazax

2009-05-26 02:09:49

Functions and procedures for the world map:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป World Map Routines --//
//-----------------------------------------------------------------//
// * Procedure OpenWorldMap; // * by Cazax
// * Function IsWorldMapOpened: Boolean; // * by Cazax
// * Procedure CloseWorldMap; // * by Cazax
// * Procedure WaitWorldMap; // * by Cazax
// * Procedure SearchPlace(Place : String); // * by Cazax
// * Procedure Zoom(Percent : Integer); // * by Cazax
// * Procedure GoToPlayer; // * by Cazax


{*******************************************************************************
Procedure OpenWorldMap;
By: Cazax
Description: Opens world map
*******************************************************************************}
Procedure OpenWorldMap;
Begin
If Not LoggedIn Then
Exit;
MouseBox(527, 125, 559, 156, 1);
End;

{*******************************************************************************
Function IsWorldMapOpened: Boolean;
By: Cazax
Description: Returns true if the world map is opened
*******************************************************************************}
Function IsWorldMapOpened: Boolean;
Begin
Result := GetColor(29, 481) = 65536;
End;

{*******************************************************************************
Procedure CloseWorldMap;
By: Cazax
Description: Closes world map
*******************************************************************************}
Procedure CloseWorldMap;
Begin
If Not IsWorldMapOpened Then
Exit;
MouseBox(740, 10, 755, 25, 1);
End;

{*******************************************************************************
Procedure WaitWorldMap;
By: Cazax
Description: Waits for the world map to load
*******************************************************************************}
Procedure WaitWorldMap;
Var
T : Integer;
Begin
T := GetTickCount;
While (GetColor(229, 154) = 0) Do
Begin
Wait(250 + Random(350));
If Random(5) = 0 Then
IdleTime(250 + Random(500), 3, 2);
If TimeFromMark(T) > 15000 Then
Begin
Writeln('World map opening is taking too much time');
CloseWorldMap;
Exit;
End;
End;
End;

{*******************************************************************************
Procedure SearchPlace(Place : String);
By: Cazax
Description: Finds a place using the searcher
*******************************************************************************}
Procedure SearchPlace(Place : String);
Begin
If Not isWorldMapOpened Then
Exit;
TypeSend(Place);
While IsMoving(250) Do
Wait(150 + Random(100));
End;

{*******************************************************************************
Procedure Zoom(Percent : Integer);
By: Cazax
Description: Zooms the world map according to the percent. It can be 37, 50, 75, 100 or 200
*******************************************************************************}
Procedure Zoom(Percent : Integer);
Var
T, I : Integer;
Begin
If Not IsWorldMapOpened Then
Exit;
If Not InIntArray([37, 50, 75, 100, 200], Percent) Then
Begin
Writeln('Incorrect zoom percent');
Exit;
End;
For I := 1 To 4 Do
Begin
MouseBox(742, 480, 757, 495, 1);
Wait(500 + Random(250));
End;
Case Percent Of
37: Exit;
50: T := 1;
75: T := 2;
100: T := 3;
200: T := 4;
End;
For I := 1 To T Do
Begin
MouseBox(742, 464, 755, 477, 1);
Wait(500 + Random(250));
End;
End;

{*******************************************************************************
Procedure GoToPlayer;
By: Cazax
Description: Goes to the player's position using the 'You are here' sign
*******************************************************************************}
Procedure GoToPlayer;
Var
TPA : TPointArray;
X, Y : Integer;
Box : TBox;
Begin
If Not IsWorldMapOpened Then
Exit;
If FindColorsTolerance(TPA, 9100798 , 0, 0, 764, 502, 10) Then
Begin
Box := GetTPABounds(TPA);
MouseBox(Box.X1, Box.Y1, Box.X2, Box.Y2, 1);
While IsMoving(250) Do
Wait(150 + Random(100));
End;
End;

Shuttleu

2009-05-26 02:21:33

how about this?

{*******************************************************************************
Procedure OpenWorldMap;
By: Cazax edited by Shuttleu
Description: Opens world map
*******************************************************************************}
Procedure OpenWorldMap;
Begin
If Not LoggedIn Then
Exit;
MouseBox(527, 125, 559, 156, 1);
WaitWorldMap;
End;
then put that under WaitWorldMap

~shut

marpis

2009-06-01 18:18:33

where can this be used? o_0

ShowerThoughts

2009-06-01 18:23:24

Seriously everyone making functions and procedures for SRL, which is great I really mean great, but please create a script instead of making thousand functions.

Just an advice :)

Naike

2009-06-01 18:39:30

From: Hermen
Seriously everyone making functions and procedures for SRL, which is great I really mean great, but please create a script instead of making thousand functions.

Just an advice :)


How about being positive about us contributing to SRL and you make the scripts ;D?

Nice add Cazax!

Quickmarch

2009-06-01 18:43:35

Hmm, i can't really see this being used much. Nice anyway. :)

ShowerThoughts

2009-06-01 18:44:35

From: N1ke!
How about being positive about us contributing to SRL and you make the scripts ;D?


Naice add Cazax.


Did you even read what I have written?
It said I am positive about contributing and I got private scripts, which I am about to release I just need 1 p2p pin for my script then I will release(flawless, AFAIK).

Cazax

2009-06-02 01:18:23

Thanks :p There is a new world map so I better fix this soon…

ShowerThoughts

2009-06-02 01:24:48

Although, I will probably might never ever use this, good job. ;)

Wizzup?

2009-06-02 01:26:36

From: Hermen
Seriously everyone making functions and procedures for SRL, which is great I really mean great, but please create a script instead of making thousand functions.

Just an advice :)


That makes no sense.

Go Cazax, nice work!

Cazax

2009-06-02 03:07:57

Fixed.
This could be a great antiban :)
Thanks for the cheer Wizzup

Bebe

2009-06-02 05:42:27

From: Hermen
Did you even read what I have written?
It said I am positive about contributing and I got private scripts, which I am about to release I just need 1 p2p pin for my script then I will release(flawless, AFAIK).

I love when people say their scripts are flawless. It really makes me laugh. Thank you for brightening my day. :)

N2 Edit: I <3 bitterness posts.

ShowerThoughts

2009-06-02 09:17:04

From: Bebe
I love when people say their scripts are flawless. It really makes me laugh. Thank you for brightening my day. :)

N2 Edit: I <3 bitterness posts.


You're right, define flawless? If smart is not functioning(lose of focus), my script fails, flawless or not?