Hey, I'm Currently Making a Mage Based Scipt, and Thus Came Across The Problem Of Selecting Which Spell To Use, So I Made This Procedure,
Bassically It Picks The Best Spell Avaluable, It Only Works For Mages Whom, Use A Staff, But Lets Be Honest Most Mages Do.
SCAR Code:
Function WhichStaffSpell : String;
Var
SLX1, SLY1, SLX2, SLY2 : Integer;
Tx, Ty, Px, Py : Integer;
SpellChoice, Elemant, SpType : String;
Begin
SLX1 := 552;
SLY1 := 268;
SLX2 := 730;
SLY2 := 288;
GameTab(1);
Mouse(656, 254, 50, 40, True);
While FindColorTolerance(Tx, Ty, 1777020, 560, 222, 727, 423, 10) Do
Wait(500);
Repeat
MMouse((705 - Px), (425 - Py), 4, 4)
wait(200+random(100))
If(Not(FindColorTolerance(Tx, Ty, 255, SLX1, SLY1, SLX2, SLY2, 5)))Then
Begin
Mouse((705 - Px), (425 - Py), 4, 4, True)
Break;
End Else
Begin
If(Px<110)Then
Begin
Px := Px + 40
End Else
Begin
Px := 0;
If(Py<170)Then
Begin
Py := Py + 60
End Else
Begin
Writeln('Could Not Find Any Spells')
Mouse(686, 450, 34, 7, True)
Result := 'None'
Exit;
End;
End;
If(Py>100)Then
Begin
SLY1 := 443;
SLY2 := 459;
End;
End;
Until(False)
If Px = 0 Then
Elemant := 'Fire';
If Px = 40 Then
Elemant := 'Earth';
If Px = 80 Then
Elemant := 'Water';
If Px = 120 Then
Elemant := 'Wind';
If Py = 0 Then
SpType := 'Wave';
If Py = 60 Then
SpType := 'Blast';
If Py = 120 Then
SpType := 'Bolt';
If Py = 180 Then
SpType := 'Strike';
SpellChoice := Elemant + ' ' + SpType
Writeln('Picked Spell : ' + SpellChoice)
Wait(1000+random(1000))
Result := SpellChoice;
End;
And For Use I'd Do This
SCAR Code:
{.include Srl/Srl/Skill/Magic.scar}
Cast(WhichStaffSpell)
Cheers
Tv.