SRL Archive - SRL Archives

8 More New Functions


Rich

2009-09-02 18:53:39

Self-explanatory. Another 8 functions from me.

{*******************************************************************************
function IsLoginStill : Boolean;
By: R1ch
Description: Returns true if the login page is still
*******************************************************************************}
function IsLoginStill : Boolean;
begin
if LoggedIn then Exit;
Result:= GetColor(16, 487) = 2302956;
end;

{*******************************************************************************
function MakeLoginStill(Still : Boolean) : Boolean;
By: R1ch
Description: Makes login page still, depending on Still
*******************************************************************************}
function MakeLoginStill(Still : Boolean) : Boolean;
begin
if LoggedIn then Exit;
if not (IsLoginStill xor Still) then
Mouse(16, 487, 7, 7, True);
Result:= True;
end;

{*******************************************************************************
function GetCastStance : Boolean;
By: R1ch
Description: Returns true if cast stance is defensive.
*******************************************************************************}
function GetCastStance : Boolean;
begin
GameTab(tab_Magic);
Result:= GetColor(562, 441) = 16777215;
end;

{*******************************************************************************
function MakeCastStance(Defensive : Boolean) : Boolean;
By: R1ch
Description: Makes cast stance defensive or regular, depending on Defensive
*******************************************************************************}
function MakeCastStance(Defensive : Boolean) : Boolean;
begin
GameTab(tab_Magic);
if not (GetCastStance xor Defensive) then
Mouse(562, 450, 7, 7, True);
Result:= True;
end;

{*******************************************************************************
function HiddenSpells : TBooleanArray;
By: R1ch
Description: Returns spells which are hidden in the spell book in a TBA
0 = Combat 1 = Tele 2 = Misc 3 = Skill
*******************************************************************************}
function HiddenSpells : TBooleanArray;
var
I : Byte;

begin
GameTab(tab_Magic);
for I:= 0 to 3 do
Result[i]:= GetColor(592 + (I * 22), 441) = 16777215;
end;

{*******************************************************************************
function HideSpells(Combat, Tele, Misc, Skill : Boolean) : Boolean;
By: R1ch
Description: Makes cast stance defensive or regular, depending on Defensive
*******************************************************************************}
function HideSpells(Spells : TBooleanArray) : Boolean;
var
I : Byte;

begin
if High(Spells) > 3 then
begin
SRL_Warn('HideSpells', 'Only 4 parameter in Spells to be used', warn_AllVersions);
Exit;
end;
GameTab(tab_Magic);
for I:= 0 to 3 do
if not (HiddenSpells[i] xor Spells[i]) then
Mouse(592 + (I * 22), 450, 7, 7, True);
Result:= True;
end;

{*******************************************************************************
function GetMagicSortBy : Integer;
By: R1ch
Description: Gets the current way the magic spells are sorted by
0 = Level 1 = Combat 2 = Teleport
*******************************************************************************}
function GetMagicSortBy : Integer;
var
I : Byte;

begin
GameTab(tab_Magic);
for I:= 0 to 2 do
if GetColor(658 + (22 * I), 441) = 16777215 then
Result:= I;
end;

{*******************************************************************************
function MakeMagicSortBy(Sort : Integer) : Boolean;
By: R1ch
Description: Changes the way the magic spells are sorted by
0 = Level 1 = Combat 2 = Teleport
*******************************************************************************}
function MakeMagicSortBy(Sort : Integer) : Boolean;
var
I : Byte;

begin
if Sort > 2 then
begin
SRL_Warn('MakeMagicSort', '0..2 for Sort : Integer', warn_AllVersions);
Exit;
end;
GameTab(tab_Magic);
I:= GetMagicSortBy;
if not (I = Sort) then
Mouse(658 + (22 * Sort), 450, 7, 7);
Result:= True;
end;

No time for typing…Must fix SRL :p

Richard.

caused

2009-09-02 19:20:27

I would make the "MakeLoginstillfunction" getting the dimensions of the client first, and then click the bottom left corner with a little distance so its gets the symbol.

Rich

2009-09-02 19:24:17

From: caused
I would make the "MakeLoginstillfunction" getting the dimensions of the client first, and then click the bottom left corner with a little distance so its gets the symbol.


Unless you don't select the client, it shouldn't be necessary should it? Please correct me if I'm wrong.

caused

2009-09-02 19:36:55

From: R1ch
Unless you don't select the client, it shouldn't be necessary should it? Please correct me if I'm wrong.


I guess it is if you are on "resizeable".

~caused

Rich

2009-09-02 19:38:53

From: caused
I guess it is if you are on "resizeable".

~caused


I thought so. Thanks anyway.

Richard.

Naum

2009-09-02 23:05:37

Alot could be shortened, for example:

function MakeCastStance(Defensive : Boolean) : Boolean;
begin
GameTab(tab_Magic);
if (GetCastStance xor Defensive) then
Result:= True
else
Mouse(562, 450, 7, 7, True);
end;

To:

function MakeCastStance(Defensive : Boolean) : Boolean;
begin
GameTab(tab_Magic);
Result:= GetCastStance xor Defensive;
If Not Result Then
Mouse(562, 450, 7, 7, True);
end;


Also you should use Byte's instead of Integers ;)
:)

Rich

2009-09-02 23:22:30

From: NaumanAkhlaQ
Alot could be shortened, for example:

Code:
[LEFT]function MakeCastStance(Defensive : Boolean) : Boolean;
begin
GameTab(tab_Magic);
if (GetCastStance xor Defensive) then
Result:= True
else
Mouse(562, 450, 7, 7, True);
end;
[/LEFT]


To:

Code:
[LEFT]function MakeCastStance(Defensive : Boolean) : Boolean;
begin
GameTab(tab_Magic);
Result:= GetCastStance xor Defensive;
If Not Result Then
Mouse(562, 450, 7, 7, True);
end;
[/LEFT]



Also you should use Byte's instead of Integers ;)
:)


Changed, but not to exactly what you said, as that would not return true. Also, changed Integers to Bytes.

Thanks,
Richard

spicynachos2

2009-09-03 04:06:16

I like this alot. These are usefull for any script that uses tab_magic. It really was a pain trying to use the magic tab for a while. Do these still work after the update? I not running any scripts till its all working… :p

Rich

2009-09-03 18:24:11

From: spicynachos2
I like this alot. These are usefull for any script that uses tab_magic. It really was a pain trying to use the magic tab for a while. Do these still work after the update? I not running any scripts till its all working… :p


These were made after the update, as the Magic Tab changed a bit, so yeah, they do work.

Richard.

Rich

2009-09-07 20:17:21

Sorry for double post, but me wants Dev to see this :p

Baked0420

2009-09-07 20:19:55

the magic functions shouldn't be core though, they should be added to magic.scar, but good job Rep+. You're contributing a lot lately it seems :)

Rich

2009-09-13 00:58:37

From: R1ch on 7th September
Ah yes, of course. My mistake, sorry.


Please look Developers! :o

Naum

2009-09-13 13:51:29

From: R1ch
Please look Developers! :o


Check the Dev SVN, N1ke already did most of this..

Rich

2009-09-13 14:04:39

From: NaumanAkhlaQ
Check the Dev SVN, N1ke already did most of this..


I made these waaay before N1ke… -.-

Naike

2009-09-13 15:23:52

From: R1ch
I made these waaay before N1ke… -.-


I re-did magic.scar from scratch..
And I had this done before your release, no worries ;)

Just a side note: If you want attention on your SRL Pub stuff, simply pm an active developer, or just type to me on msn..
I don't have the time or effort to sit and watch in this forum all day, I am, aswell, only a human :)

Rich

2009-09-13 15:39:43

Ok then. I didn't want to PM people, as it may look like I'm nagging :) Could you have a look through my functions if you haven't done already please?

Thanks,
Richard.