SRL Archive - SRL Archives

SetupAutoCast


Richard

2009-07-19 03:04:10

Newer version of what I had before:

Procedure SetupAutoCast(Spell: String; Defensive: Boolean);
Var
SpellNames: Array [0..1] of Array [0..3] of String;
TSA: TStringArray;
i, x, y, xb, yb: Integer;
ii, SpellInt, Colours: TIntegerArray;
Begin
if not GameTab(1) then Exit;
SpellNames[0] := ['wind', 'water', 'earth', 'fire'];
SpellNames[1] := ['strike', 'bolt', 'blast', 'wave'];
Colours := [];
Mouse(655, ((Integer(not(Defensive)) * 33) + 253), 50, 25, True);
TSA := srl_Explode(Spell, ' ');
For i := 0 to 1 do
For ii[i] := 0 to 3 do
If (TSA[ii[i]] = SpellNames[i][ii[i]]) then
SpellInt[i] := ii[i];
xb := ((SpellInt[0] * 40) + 503)
yb := ((SpellInt[1] * 61) + 124)
If FindColorTolerance(x, y, Colours[SpellInt[0] * SpellInt[1]], xb + 5, yb + 5, xb - 5, yb - 5, 20) then
Mouse(xb, yb, 3, 3, True);
end;

This only works in theory, there is no way to check if the opening of auto cast setup works, or any of the spells works as of yet. Could someone with the spells active please do this?

Thanks

Nadeem

2009-07-20 07:09:46

It looks good :) Should work though as it seems.



~NS

n3ss3s

2009-07-20 11:04:57

You should use InStrArrEx to get which element your spell is, and then again for which style, so you get your row and column in only 2 lines…

Richard

2009-07-20 20:30:14

From: n3ss3s
You should use InStrArrEx to get which element your spell is, and then again for which style, so you get your row and column in only 2 lines…


Thanks, I'll implement that now.

Procedure SetupAutoCast(Spell: String; Defensive: Boolean);
Var
SpellNames: Array [0..1] of Array [0..3] of String;
TSA: TStringArray;
i, x, y, xb, yb: Integer;
SpellInt, Colours: TIntegerArray;
Begin
if not GameTab(1) then Exit;
SpellNames[0] := ['wind', 'water', 'earth', 'fire'];
SpellNames[1] := ['strike', 'bolt', 'blast', 'wave'];
Colours := [];
Mouse(655, ((Integer(not(Defensive)) * 33) + 253), 50, 25, True);
TSA := srl_Explode(Spell, ' ');
For i := 0 to 1 do
If not(InStrArrEx(TSA[i], SpellNames[i], SpellInt[i])) then
Begin
srl_Warn(SetupAutoCast, ' Invalid spell name', warn_AllVersion);
Exit;
end;
xb := ((SpellInt[0] * 40) + 503)
yb := ((SpellInt[1] * 61) + 124)
If FindColorTolerance(x, y, Colours[SpellInt[0] * SpellInt[1]], xb + 5, yb + 5, xb - 5, yb - 5, 20) then
Mouse(xb, yb, 3, 3, True);
end;

Now also yells at you for bad spells.

EvilChicken!

2009-08-22 03:00:59

If you made a version that worked, I'd commit it.
Looks really nice IMO.

JPHamlett

2009-08-25 05:20:42

[Runtime Error] : Could not call proc

its the first string line

Richard

2009-08-25 13:59:07

Never had that problem, guessing its another one of the 3.20+ problems.

ZephyrsFury

2009-08-25 14:18:55

From: Richard
Never had that problem, guessing its another one of the 3.20+ problems.


You can't set static arrays like that in 3.15 or 3.20+. However it never errored in 3.15, just terminated the script.

Richard

2009-08-26 18:52:22

From: EvilChicken!
If you made a version that worked, I'd commit it.
Looks really nice IMO.


Nauman did have a working version, but it would appear he deleted his post…

Sabzi

2009-08-26 19:18:06

From: Richard
Nauman did have a working version, but it would appear he deleted his post…


He just moved it.

Naum

2009-08-26 20:11:28

From: Sabzi
He just moved it.


Seeing as no one really paid attention to this post I made another thread, with a bit more shortenings:

http://www.villavu.com/forum/showthread.php?p=621369#post621369

I hope people pay attention to that.