Alright, Cast no longer seems to work. I've tried it with multiple different spells and it always returns false (and doesn't do anything but change to the magic tab), even if the spell can be cast.
I'm using the OpenDev Repository.
Alright, Cast no longer seems to work. I've tried it with multiple different spells and it always returns false (and doesn't do anything but change to the magic tab), even if the spell can be cast.
I'm using the OpenDev Repository.
Edit it then
I'll check it out later
T~M
Would this be due to the new style of the magic interface? With the new way of laying out spells?
Edit sorry read wrong
T~M
Last edited by Dynamite; 05-21-2009 at 04:31 AM.
Yes. Would fix it, but stuck up with other sheite ;/
I'll get on to it. In another 16 hrs
- because of sleep.
I think we're going to have to start adding a new method of spell casting.
Look at the include:
SCAR Code:function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II, CTS: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
case (Lowercase(Spell)) of
'home teleport': Spell := 'lumbridge home teleport';
'bolt enchantment': Spell := 'enchant crossbow bolt';
'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
end;
spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'bounty locate', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
'teleother camelot'];
Spell := Lowercase(Spell);
if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
spNo := StrToInt(Spell) - 1
else
if (not(InStrArrEx(Spell, spArr, spNo))) then
begin
srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
Exit;
end;
if (GetCurrentTab <> 7) then
begin
GameTab(7);
Wait(500 + Random(500));
end;
B.X1 := spNo mod 7 * 24 + 560;
B.Y1 := spNo div 7 * 24 + 217;
B.X2 := B.X1 + 23;
B.Y2 := B.Y1 + 23;
if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
FixSpells;
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.72, 1.05);
for II := 0 to High(colArr) do
begin
if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Result := (Lum > 20.0);
if (Result) then
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
Wait(500 + Random(500));
end;
end;
It only runs on coords, and with the new system, it probably has different coords than the new system. I'll see what I can do.
I know what to do, I have an Idea on how to tackle this - It can be done with making a grid of boxes based on some vars so if the boxes change all you do is specify a new start co-ord.
Btw have you checked that B.X1 etc are right? Because if you change those then it might fix it![]()
I found the problem! Bounty Locate has been removed!
Here is a fixed version:
SCAR Code:function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II, CTS: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
case (Lowercase(Spell)) of
'home teleport': Spell := 'lumbridge home teleport';
'bolt enchantment': Spell := 'enchant crossbow bolt';
'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
end;
spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
'teleother camelot'];
Spell := Lowercase(Spell);
if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
spNo := StrToInt(Spell) - 1
else
if (not(InStrArrEx(Spell, spArr, spNo))) then
begin
srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
Exit;
end;
if (GetCurrentTab <> 7) then
begin
GameTab(7);
Wait(500 + Random(500));
end;
B.X1 := spNo mod 7 * 24 + 560;
B.Y1 := spNo div 7 * 24 + 217;
B.X2 := B.X1 + 23;
B.Y2 := B.Y1 + 23;
if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
FixSpells;
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.72, 1.05);
for II := 0 to High(colArr) do
begin
if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Result := (Lum > 20.0);
if (Result) then
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
Wait(500 + Random(500));
end;
end;
What about support for the different ways of organising the spells? I'll see if I can make it change to the default method after gametab(7) is called.
I already made a spell organizer... Though nobody paid attention: http://www.villavu.com/forum/showthread.php?t=43392
Then surely you'd just:
SCAR Code:Function GetMagicsSort: Integer;
Var
I : Integer;
Pnts : TPointArray;
Begin
GameTab(7);
Wait(150 + Random(100));
Pnts := [Point(678, 443), Point(697, 443), Point(716, 443)];
For I := 0 To 2 Do
If GetColor(Pnts[i].X, Pnts[i].Y) <> 7038086 Then
Begin
Result := I + 1;
Exit;
End;
End;
Procedure SortMagics(Order : Integer);
Var
X : Integer;
Begin
If Not InIntArray([1, 2, 3], Order) Then
Exit;
X := 659 + (19 * Order);
GameTab(7);
MouseBox(X, 443, X + 12, 458, 1);
End;
function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II, CTS: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
case (Lowercase(Spell)) of
'home teleport': Spell := 'lumbridge home teleport';
'bolt enchantment': Spell := 'enchant crossbow bolt';
'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
end;
spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
'teleother camelot'];
Spell := Lowercase(Spell);
if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
spNo := StrToInt(Spell) - 1
else
if (not(InStrArrEx(Spell, spArr, spNo))) then
begin
srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
Exit;
end;
if (GetCurrentTab <> 7) then
begin
GameTab(7);
Wait(500 + Random(500));
end;
SortMagics(1);
B.X1 := spNo mod 7 * 24 + 560;
B.Y1 := spNo div 7 * 24 + 217;
B.X2 := B.X1 + 23;
B.Y2 := B.Y1 + 23;
if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
FixSpells;
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.72, 1.05);
for II := 0 to High(colArr) do
begin
if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Result := (Lum > 20.0);
if (Result) then
begin
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
Wait(500 + Random(500));
end;
end;
No?












Glad I could help.
There are currently 1 users browsing this thread. (0 members and 1 guests)