SRL Archive - SRL Archives

New SetUpAutoCast


Naum

2009-06-15 21:31:24

function SetUpAutoCast(AutoSpell: string; Defensive: Boolean): Boolean;
var
X, Y, Col, Row, Msk: Integer;
TB : TBox;
Spells, ColArray : TVariantArray;
begin
if not GameTab(1) then exit;
if Defensive then
Mouse(655, 253, 50, 25, True)
else Mouse(665, 320, 50, 25, True);
Wait(2000 + Random(1500));
Spells := ['', 'wind strike', 'water strike', 'earth strike', 'fire strike',
'wind bolt', 'water bolt', 'earth bolt', 'fire bolt',
'wind blast', 'water blast', 'earth blast', 'fire blast',
'wind wave', 'water wave', 'earth wave', 'fire wave'];
ColArray := [16579836, 16579836, 3003805, 835570];
Try Msk := StrToIntDef(AutoSpell, -1) Except end;
If Msk <> -1 Then
Row := Trunc(Msk Div 4) + 1
Else
For Msk := 0 to High(Spells) Do
If AutoSpell = Spells[Msk] Then
Row := Trunc(Msk Div 4) + 1;

If (Msk Mod 4) = 0 Then Dec(Row);
Col := Msk Mod 4;
If Col = 0 Then Col := 4;
TB.x1 := 571 + 40 * (Col - 1);
TB.y1 := 229 + 60 * (Row - 1);
TB.x2 := TB.x1 + 40;
TB.y2 := TB.y1 + 60;
For Msk := 0 to High(Spells) Do
case LowerCase(AutoSpell) of
Spells[Msk], IntToStr(Msk) : Result := FindColor(X, Y, ColArray[Msk Mod 4], TB.x1, TB.y1, TB.x2, TB.y2);
end;
If Result <> True Then
begin
srl_Warn('SetUpAutoCast', '"' + AutoSpell + '" is not a valid autocasting spell.', -2);
Mouse(687, 448, 9, 4, True); // Exits the autocasting spells setup 'popup'.
end;
if Result then Mouse(X, Y, 2, 2, True);
end;

The old one went through all the find colors. It is also a bit faster. :). Moreover, I changed the co-ords a bit so it would actually cancel the pop-up correctly.

Open to any criticism.

Also this has only been tested on around 7 prayers as that's all the quick prayers my character can do. Testing would be appreciated :)

NCDS

2009-06-15 21:35:11

and added spell's?!

atleast I'm pretty sure they weren't in there before.

Looks nice :)

Naum

2009-06-15 22:36:00

Yeah, The spells were there, I just shoved them in an array and used some math to get the co-ords.

Now all I need is testing :rolleyes:

NCDS

2009-06-15 22:48:14

oddly enough I am making a maging script right now >.>

I'm pretty sure I can use this so I will let you know.

Naike

2009-06-15 23:02:10

Didn't you speak about user friendlyness like 2 days ago? >;]
I still love you haha

Naum

2009-06-16 23:00:00

From: N1ke!
Didn't you speak about user friendlyness like 2 days ago? >;]
I still love you haha


No it's I still 'less-than 3 you'. And that was reader friendlyness and I really didn't bother, like you, I think it looks reader friendly. And a skilled 'jr.mem' should be able to understand it :)

I still <3 you hoho.

Edit: Updated the code.

Iroki

2009-06-18 11:13:19

Nice Nauman :) Looks very nice.

Naum

2009-06-18 22:45:49

From: Iroki
Nice Nauman :) Looks very nice.


Woo, your suddenly active ;). Thanks :)

Nadeem

2009-06-19 00:15:08

Nice Nauman :)

I'll be using this is my new script.



~NS

Naum

2009-06-19 19:21:36

From: Nadeem
Nice Nauman :)

I'll be using this is my new script.



~NS


New Script *tell us*, Great all you people liked it :)

Nadeem

2009-06-19 19:51:42

From: NaumanAkhlaQ
New Script *tell us*, Great all you people liked it :)


haha its a secret :)

hint: its a fighting script, in a cave :P



~NS

Naum

2009-06-20 14:51:46

Cool, So is this useful or not?