SRL Archive - SRL Archives

Some Moar GM Tab funcs!


Naum

2009-05-12 23:45:37

Made these ones for the new prayer menu, good for combat or antiban:

Function InQuickPrayerMenu : Boolean;
Var TPA : TPointArray;
Begin
FindColorsSpiralTolerance(619, 457, TPA, 7710941, MIX1, MIY1, MIX2, MIY2, 1);
Result := (Length(TPA) > 10)
End;

Function OpenQuickPrayerMenu : Boolean;
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
Result := ChooseOption('elect')
If Result Then
Wait(800 + Random(400));
End;

Procedure TurnQuickPrayer;
Var xx, yy : Integer;
Begin
If Not FindText(xx, yy, '0', NPCChars, 742, 64, 750, 72) Then
If Not GetColor(726, 76) = 13822676) Then
Mouse(711, 54, 40, 15, True);
End;

Function SetQuickPrayers(Box : TIntegerArray) : Boolean;
Var X1, Y1, X2, Y2, I : Integer;
Tmp, Row : Integer;
Begin
{
Tmp := Length(Box); }
ClearSameIntegers(Box);
{If Tmp > Length(Box) Then
srl_Warn('SetQuickPrayers', 'Duplicate number[s] entered ', warn_AllVersions); }

If Length(Box) > 13 Then
srl_Warn('SetQuickPrayers', IntToStr(Length(Box))+' prayers cannot be selcted at once', warn_AllVersions);

For I := 0 To High(Box) Do
If Box[I] >= 28 Then
srl_Warn('SetQuickPrayers', 'Prayers in array are above the required length use numbers 1 - 27 only', warn_AllVersions);

If Not InQuickPrayerMenu Then
If OpenQuickPrayerMenu Then
Wait(1);

For I := 0 To High(Box) Do
Begin
Row := Trunc(Box[i]/5); {Rasta :D}

Begin
X1 := ((555 - 37) + (37 * Box[I]));
Y1 := ((236 - 35) + (35 * Row));
X2 := ((564 - 37) + (37 * Box[I]));
Y2 := ((242 - 35) + (35 * Row));

If (Box[I] > 5) Then
Begin
X1 := (X1 - ((37*5) * (Row-1)));
X2 := (X2 - ((37*5) * (Row-1)));
End;

If Not FindColor(Tmp, Row, 192, X1, Y1, X2, Y2) Then {<-Used origonal}
MouseBox(X1 + 6, Y1 + 6, X2 - 6, Y2 - 6, 1); { vars becuase
they would be
reset anyway}
Wait(1001 + Random(400));
End;
End;
If Random(2) = 1 Then
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
Result := ChooseOption('inish');
Exit;
End;
Begin
Result := FindText(X1, Y1, 'onfirm', TradeChars, 605, 443, 700, 460);
Mouse(X1 + 15, Y1 + 7, 5, 1, True);
End;
End;

Procedure TurnOffAllQuickPrayers;
Var xx, yy, I : Integer;
ATPA : T2DPointArray;
TPA : TPointArray;
Begin
If Not InQuickPrayerMenu Then
If OpenQuickPrayerMenu Then
Wait(1);

FindColorsTolerance(TPA, 192, MIX1, MIY1, MIX2, MIY2, 0);
ATPA := TPAToATPA(TPA, 30);
For I := 0 to High(ATPA) Do
If MiddleTPAEx(ATPA[I], xx, yy) Then
Begin
Mouse(xx - 3, yy, 0, 0, True);
Wait(400 + Random(200));
End;

If FindText(xx, yy, 'onfirm', TradeChars, 605, 443, 700, 460) Then
Mouse(xx + 15, yy + 7, 5, 1, True);
End;

Dynamite

2009-05-12 23:49:13

From: NaumanAkhlaQ
Made these ones for the new prayer menu, good for combat or antiban:

Function InQuickPrayerMenu : Boolean;
Var TPA : TPointArray;
Begin
FindColorsSpiralTolerance(619, 457, TPA, 7710941, MIX1, MIY1, MIX2, MIY2, 1);
Result := (Length(TPA) > 10)
End;

Function OpenQuickPrayerMenu : Boolean;
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
Result := ChooseOption('elect')
If Result Then
Wait(800 + Random(400));
End;

Procedure TurnQuickPrayer;
Var xx, yy : Integer;
Begin
If Not FindText(xx, yy, '0', NPCChars, 742, 64, 750, 72) Then
Mouse(711, 54, 40, 15, True);
End;

Function SetQuickPrayers(Box : TIntegerArray) : Boolean;
Var X1, Y1, X2, Y2, I : Integer;
Tmp, Row : Integer;
Begin
{
Tmp := Length(Box); }
ClearSameIntegers(Box);
{If Tmp > Length(Box) Then
srl_Warn('SetQuickPrayers', 'Duplicate number[s] entered ', warn_AllVersions); }

If Length(Box) > 13 Then
srl_Warn('SetQuickPrayers', IntToStr(Length(Box))+' prayers cannot be selcted at once', warn_AllVersions);

For I := 0 To High(Box) Do
If Box[I] >= 28 Then
srl_Warn('SetQuickPrayers', 'Prayers in array are above the required length use numbers 1 - 27 only', warn_AllVersions);

If Not InQuickPrayerMenu Then
If OpenQuickPrayerMenu Then
Wait(1);

For I := 0 To High(Box) Do
Begin
If InRange(Box[I], 1, 5) Then Row := 1;
If InRange(Box[I], 6, 10) Then Row := 2;
If InRange(Box[I], 11, 15) Then Row := 3;
If InRange(Box[I], 16, 20) Then Row := 4;
If InRange(Box[I], 21, 25) Then Row := 5;

Begin
X1 := ((555 - 37) + (37 * Box[I]));
Y1 := ((236 - 35) + (35 * Row));
X2 := ((564 - 37) + (37 * Box[I]));
Y2 := ((242 - 35) + (35 * Row));

If (Box[I] > 5) Then
Begin
X1 := (X1 - ((37*5) * (Row-1)));
X2 := (X2 - ((37*5) * (Row-1)));
End;

If Not FindColor(Tmp, Row, 192, X1, Y1, X2, Y2) Then {<-Used origonal}
MouseBox(X1 + 6, Y1 + 6, X2 - 6, Y2 - 6, 1); { vars becuase
they would be
reset anyway}
Wait(1001 + Random(400));
End;
End;
If Random(2) = 1 Then
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
Result := ChooseOption('inish');
Exit;
End;
Begin
Result := FindText(X1, Y1, 'onfirm', TradeChars, 605, 443, 700, 460);
Mouse(X1 + 15, Y1 + 7, 5, 1, True);
End;
End;

Procedure TurnOffAllQuickPrayers;
Var xx, yy, I : Integer;
ATPA : T2DPointArray;
TPA : TPointArray;
Begin
If Not InQuickPrayerMenu Then
If OpenQuickPrayerMenu Then
Wait(1);

FindColorsTolerance(TPA, 192, MIX1, MIY1, MIX2, MIY2, 0);
ATPA := TPAToATPA(TPA, 30);
For I := 0 to High(ATPA) Do
If MiddleTPAEx(ATPA[I], xx, yy) Then
Begin
Mouse(xx - 3, yy, 0, 0, True);
Wait(400 + Random(200));
End;

If FindText(xx, yy, 'onfirm', TradeChars, 605, 443, 700, 460) Then
Mouse(xx + 15, yy + 7, 5, 1, True);
End;


Looks good :)
Help1ng the community again ;)
Thank you

T~M

footballjds

2009-05-12 23:50:50

if quick prayer is on then itl turn it off. u should have something to see if its on ;)
xor will help you if u know how to use it !

Naum

2009-05-12 23:53:16

Okay Ill fix that :).

Thanks for the fast replies!!

Fixed.

footballjds

2009-05-13 00:05:00

np. kewl ;)

Sir R. M8gic1an

2009-05-13 00:15:02

QuickPrayer? eh? never heard of it. Explain / show?


If InRange(Box[i], 1, 5) Then Row := 1;
If InRange(Box[i], 6, 10) Then Row := 2;
If InRange(Box[i], 11, 15) Then Row := 3;
If InRange(Box[i], 16, 20) Then Row := 4;
If InRange(Box[i], 21, 25) Then Row := 5;

Row := Trunc(Box/5);

~RM

Naum

2009-05-13 00:25:03

Rasta Own me now!!

Added your thingy!! you own


Shuttleu

2009-05-13 00:46:04

ooo… when did quick prayer become avaliable?

~shut

Naum

2009-05-13 00:53:35

Lol.. I thought you guys were mean't to be on top of things,

I thought Lordsaturn would have made these functions already :p

Sir R. M8gic1an

2009-05-13 01:08:20

From: NaumanAkhlaQ
Lol.. I thought you guys were mean't to be on top of things,

I thought Lordsaturn would have made these functions already :p


hadn't checked :p

seen it now, will look over functions tomorrow.

~RM

Gu3st...

2009-05-13 01:19:21

lol, quickprayers is'nt something new :P
Like.. 2 months old? It was new when I did dragon slayer on one of my accounts…

Great work here NaumanAkhlaQ (lmfao, wonder why ppl have problems writing ur name..)

Zlakata

2009-05-13 01:23:05

From: Shuttleu
ooo… when did quick prayer become avaliable?

~shut


It has quite some time, since 2009 is the tweak year, they made it convenient to use prayers in Pvp or PvE.

Naum

2009-05-13 16:07:11

AnyOne want to have a look over them?

n3ss3s

2009-05-13 17:35:11

For people who might script using quick prayers, keep in mind (unless it's been fixed), enabling quick prayers disables all other prayers, happened to me in PvP with whip, didn't lose it though…

Sir R. M8gic1an

2009-05-13 18:12:20

i just went through the functions. They're good, i'll make some changes and include them

~RM

Naum

2009-05-13 18:18:49

<3 Rm!

Floor66

2009-05-13 18:24:14

Kwl! Been kinda waiting for someone to make it ;)
You did good on it !

Sir R. M8gic1an

2009-05-13 22:18:41


{*******************************************************************************
Function InQuickPrayerMenu : Boolean;
By: Rasta Magician
Description: Returns true if in menu to choose Quick Prayers
*******************************************************************************}
Function InQuickPrayerMenu : Boolean;
Var TPA : TPointArray;
Begin
FindColorsTolerance(TPA, 2070783, 634, 447, 677, 463, 0);
Result := (Length(TPA) = 71);
End;

{*******************************************************************************
Function OpenQuickPrayerMenu : Boolean;
By: NaumanAkhlaQ
Description: Opens The Quick Prayer Menu
*******************************************************************************}
Function OpenQuickPrayerMenu : Boolean;
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
Result := ChooseOption('elect')
If Result Then
Wait(800 + Random(400));
Result := InQuickPrayerMenu;
End;

{*******************************************************************************
Function ExitQuickPrayerMenu: boolean;
By: NaumanAkhlaQ
Description: Closes The Quick Prayer Menu
*******************************************************************************}
Function ExitQuickPrayerMenu: boolean;
begin
if not InQuickPrayerMenu then exit;

If Random(2) = 0 Then
Begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
ChooseOption('inish');
end else
Mouse(634, 447, 43, 16, True);

wait(500 + Random(500));
Result := not InQuickPrayerMenu;
end;

{*******************************************************************************
Procedure SwitchQuickPrayer(TurnOn: boolean);
By: Rasta Magician
Description: Turns Quick Prayer on / off
*******************************************************************************}
Procedure SwitchQuickPrayer(TurnOn: boolean);
Var str : string;
Begin
if not LoggedIn then exit;
if GetMMLevels('prayer', str) <= 0 then exit;

If TurnOn xor (GetColor(722, 78) <> 5711158) Then
Mouse(711, 54, 40, 15, True);
End;

{*******************************************************************************
Procedure ChooseQuickPrayer(Prayer: integer; TurnOn: boolean);
By: Rasta Magician
Description: Turns a specific Prayer on/off
*******************************************************************************}
Procedure ChooseQuickPrayer(Prayer: integer; TurnOn: boolean);
Var
Row, Col, x, y: Integer;
begin
if not LoggedIn then exit;
If Not InQuickPrayerMenu Then
If not OpenQuickPrayerMenu Then
exit;

if (Prayer <= 0)or(Prayer > 27) then
begin
srl_Warn('ChooseQuickPrayer', 'Invalid prayer number: '+IntToStr(Prayer), warn_AllVersions);
exit;
end;

Row := Trunc(Prayer/5) + 1;
if (Prayer mod 5) = 0 then Dec(Row);

Col := Prayer mod 5;
if Col = 0 then Col := 5;

x := 558 + 37*(col - 1);
y := 242 + 35*(row - 1);

if (GetColor(x, y) <> 527599) xor TurnOn then
begin
Mouse(x, y, 3, 3, True);
wait(300+random(300));
end;
end;

{*******************************************************************************
Function SetQuickPrayers(Prayers : TIntegerArray; TurnOn: boolean) : Boolean;
By: NaumanAkhlaQ & Rasta Magician
Description: Enables quick prayers by number.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27
*******************************************************************************}
Procedure SetQuickPrayers(Prayers : TIntegerArray; TurnOn:boolean);
Var
i: integer;
Begin
if not LoggedIn then exit;
If Not InQuickPrayerMenu Then
If not OpenQuickPrayerMenu Then
exit;

ClearSameIntegers(Prayers);

If Length(Prayers) > 13 Then
begin
srl_Warn('SetQuickPrayers', IntToStr(Length(Prayers))+' prayers cannot be selected at once', warn_AllVersions);
SetLength(Prayers, 13);
end;

For I := 0 To High(Prayers) Do
ChooseQuickPrayer(Prayers[i], TurnOn);

ExitQuickPrayerMenu;

End;



{*******************************************************************************
Procedure TurnOffAllQuickPrayers;
By: NaumanAkhlaQ edited by Rasta Magician
Description: Turns off all quick prayer.
*******************************************************************************}
Procedure TurnOffAllQuickPrayers;
Var
Row, Col, i, x, y : Integer;
TPA : TPointArray;
Begin
if not loggedIn then exit;
If Not InQuickPrayerMenu Then
If not OpenQuickPrayerMenu Then
exit;

for i := 1 to 27 do
ChooseQuickPrayer(i, false);

ExitQuickPrayerMenu;

End;

http://www.villavu.com/repositories/srl-opendev/SRL/skill/Prayer.scar

~RM

EvilChicken!

2009-05-13 22:51:37

Ok, RM, I edited it a tiny bit, please make it compile and I (or you, for that sake) can add it to Prayer.scar. Nice work, btw!

(And, please, make this version compile.)
I messed with ChooseQuickPrayer; I replaced all occurences of the "I" value with "Prayer", as I never gets assigned to anything.
Anyway, look at it, make it compile, finish it, test it and please do post it here finally. ^^

{.include SRL/SRL.scar}

{*******************************************************************************
Function InQuickPrayerMenu : Boolean;
By: Rasta Magician
Description: Returns true if in menu to choose Quick Prayers
*******************************************************************************}
function InQuickPrayerMenu: Boolean;
var
TPA: TPointArray;

begin
FindColorsTolerance(TPA, 2070783, 634, 447, 677, 463, 0);
Result := (Length(TPA) = 71);
end;

{*******************************************************************************
Function OpenQuickPrayerMenu : Boolean;
By: NaumanAkhlaQ
Description: Opens The Quick Prayer Menu
*******************************************************************************}
function OpenQuickPrayerMenu: Boolean;
begin
Result := InQuickPrayerMenu;
if (not LoggedIn) or (Result) then exit;
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
if ChooseOption('elect') then
begin
Wait(800 + Random(400));
Result := InQuickPrayerMenu;
end;
end;

{*******************************************************************************
function ExitQuickPrayerMenu: boolean;
By: NaumanAkhlaQ
Description: Closes The Quick Prayer Menu
*******************************************************************************}
function ExitQuickPrayerMenu: boolean;
begin
if not InQuickPrayerMenu then exit;
if (Random(2) = 0) then
begin
Mouse(711, 54, 40, 15, False);
Wait(200 + Random(200));
ChooseOption('inish');
end else
Mouse(634, 447, 43, 16, True);

Wait(500 + Random(500));
Result := (not InQuickPrayerMenu);
end;

{*******************************************************************************
Procedure SwitchQuickPrayer(TurnOn: boolean);
By: Rasta Magician
Description: Turns Quick Prayer on / off
*******************************************************************************}
procedure SwitchQuickPrayer(TurnOn: boolean);
var
Str: string;

begin
if (GetMMLevels('prayer', str) < 1) then exit;
if TurnOn xor (GetColor(722, 78) <> 5711158) then
Mouse(711, 54, 40, 15, True);
End;

{*******************************************************************************
Procedure ChooseQuickPrayer(Prayer: integer; TurnOn: boolean);
By: Rasta Magician
Description: Turns a specific Prayer on/off
*******************************************************************************}
procedure ChooseQuickPrayer(Prayer: Integer; TurnOn: Boolean);
var
Row, Col, X, Y: Integer;

begin
if not OpenQuickPrayerMenu then exit;

if (not InRange(Prayer, 1, 27)) then
begin
srl_Warn('ChooseQuickPrayer', 'Invalid prayer number: ' + IntToStr(Prayer), warn_AllVersions);
Exit;
end;

Row := Trunc(Prayer / 5) + 1;
if (Prayer mod 5 = 0) then Dec(Row);

Col := Prayer mod 5;
if (Col = 0) then Col := 5;

X := 558 + 37 * (col - 1);
Y := 242 + 35 * (row - 1);

if (GetColor(X, Y) <> 527599) xor TurnOn then
begin
Mouse(X, Y, 3, 3, True);
wait(300 + Random(300));
end;
end;

{*******************************************************************************
procedure SetQuickPrayers(Prayers: TIntegerArray; TurnOn: Boolean);
By: NaumanAkhlaQ & Rasta Magician
Description: Enables quick prayers by number.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
26 27
*******************************************************************************}
procedure SetQuickPrayers(Prayers: TIntegerArray; TurnOn: Boolean);
var
I: Byte;

Begin
if not OpenQuickPrayerMenu then exit;

ClearSameIntegers(Prayers);
if (Length(Prayers) > 13) Then
begin
srl_Warn('SetQuickPrayers', IntToStr(Length(Prayers)) + ' prayers cannot be selected at once', warn_AllVersions);
SetLength(Prayers, 13);
end;

for I := 0 To High(Prayers) do
ChooseQuickPrayer(Prayers[I], TurnOn);

ExitQuickPrayerMenu;
End;



{*******************************************************************************
Procedure TurnOffAllQuickPrayers;
By: NaumanAkhlaQ edited by Rasta Magician
Description: Turns off all quick prayer.
*******************************************************************************}
Procedure TurnOffAllQuickPrayers;
var
I: Byte;

begin
if not OpenQuickPrayerMenu then exit;
for I := 1 to 27 do
ChooseQuickPrayer(I, false);
ExitQuickPrayerMenu;
end;

begin
end.

Sir R. M8gic1an

2009-05-13 23:01:36

From: EvilChicken!
Ok, RM, I edited it a tiny bit, please make it compile and I (or you, for that sake) can add it to Prayer.scar. Nice work, btw!

(And, please, make this version compile.)
I messed with ChooseQuickPrayer; I replaced all occurences of the "I" value with "Prayer", as I never gets assigned to anything.
Anyway, look at it, make it compile, finish it, test it and please do post it here finally. ^^



EC, i see no changes… You probably edited the "unfinished" version, which i hadn't yet checked for compiling errors.

~RM

EvilChicken!

2009-05-13 23:04:46

I basically used OpenQuickPrayerMenu as a substitute for three failsafe checks in each function, and also fixed the syntax a bit. As I stated, there we no significant changes, but as I made them, I thought I might as well post them as that wouldn't do any harm.

If the unfinished version is .. unfinished, why did you post it? x3

Sir R. M8gic1an

2009-05-13 23:09:55

From: EvilChicken!
I basically used OpenQuickPrayerMenu as a substitute for three failsafe checks in each function, and also fixed the syntax a bit. As I stated, there we no significant changes, but as I made them, I thought I might as well post them as that wouldn't do any harm.

If the unfinished version is .. unfinished, why did you post it? x3


oh, noticed it (the changes) on the second read.

Well, i was anxious to post :p hadn't checked for compiling errors the first time i posted. then checked, fixed and committed (and edited post).

~RM