SRL Archive - SRL Bugs

Spell bitmaps


Shuttleu

2009-02-02 21:02:42

I have noticed that the bitmaps for the spells in the spell tab dont seem to work anymore
I dont have a account with a high enough mage lvl to fix all the bitmaps but i can fix all of them apart from the last 7
I will post the bitmaps that i get once i have made them

~shut

Cazax

2009-02-02 21:15:25

I don't like the idea of using bitmaps, because they could easily get outdated. What I have thought is to create a box surrounding the spell and check the Luminance value to see if it can be spelled.

ian.

2009-02-02 21:18:15

>.> do you need to check if the runes are there to cast the spell?

or just the things you can cast for your level?

Narcle

2009-02-02 21:52:15

Cazax: I actually have a semi updated one made, but I haven't done the Luminance thing. (was before I was dev… should be in public svn)

@99_
The spell shows up castable IF you have the runes to cast it - even if your not high enough level (last i knew).

So really the bitmaps aren't needed. I can probably make it soon as I get a luminance difference figured out. Or if someone else wants a crack at it I'll put it in next Rev.

ian.

2009-02-02 22:01:02

yes I know that, but I'm still confused on what you need to check for

ZephyrsFury

2009-02-02 22:39:00

From: Narcle
Cazax: I actually have a semi updated one made, but I haven't done the Luminance thing. (was before I was dev… should be in public svn)

@99_
The spell shows up castable IF you have the runes to cast it - even if your not high enough level (last i knew).

So really the bitmaps aren't needed. I can probably make it soon as I get a luminance difference figured out. Or if someone else wants a crack at it I'll put it in next Rev.


Hmm I've been working on a new Cast function that doesn't use bitmaps for the last couple of days. We always seem to work on the same things don't we. :p

It also seems that spells that are available have a generic 65536 colour outline whereas the others don't. EDIT: Maybe not…

Shuttleu

2009-02-03 10:53:07

From: ZephyrsFury
Hmm I've been working on a new Cast function that doesn't use bitmaps for the last couple of days. We always seem to work on the same things don't we. :p

It also seems that spells that are available have a generic 65536 colour outline whereas the others don't. EDIT: Maybe not…


your right
if it is unable to cast then the outline color is 131074 and if it is avaliable to cast then it is 65536

~shut

Narcle

2009-02-03 11:01:15

But one or the other color might be in the picture… So I'd rather be safe then sorry and do a HSL test. Think Zeph has this made already from irc convo.

Cazax

2009-02-03 11:05:18

Don't do a whole HSL test, just compare the Luminance value. You will get a huge difference.

Narcle

2009-02-03 11:12:11

From: Cazax
Don't do a whole HSL test, just compare the Luminance value. You will get a huge difference.


Yes i know that's what i meant… U use HSL convert to do the test tho :p

ZephyrsFury

2009-02-03 19:19:29

From: Shuttleu
your right
if it is unable to cast then the outline color is 131074 and if it is avaliable to cast then it is 65536

~shut


Some spells have a 65536 colour outline regardless of whether you can cast it or not. :(

From: Cazax
Don't do a whole HSL test, just compare the Luminance value. You will get a huge difference.


You're right with the luminance:


function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
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);
if (FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2)) then
begin
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
for II := 0 to High(colArr) do
begin
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
Result := (Lum > 30.0);
if (Result) then
begin
WriteLn(Lum);
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 3);
Wait(500 + Random(500));
end;
end;
end;

I've searched for the max luminance in the box around the spell and I've checked if its above a certain value (I've set this to 30.0). Hasn't been widely tested yet though.

Shuttleu

2009-02-04 14:29:36

From: ZephyrsFury
Some spells have a 65536 colour outline regardless of whether you can cast it or not. :(



You're right with the luminance:


function Cast(Spell: string): Boolean;
var
spArr: TStringArray;
spNo, X, Y, II: Integer;
B: TBox;
Lum, H, S, L: Extended;
colArr: TIntegerArray;
begin
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);
if (FindColor(X, Y, 65536, B.X1, B.Y1, B.X2, B.Y2)) then
begin
colArr := GetColors(TPAFromBox(B));
ClearSameIntegers(colArr);
for II := 0 to High(colArr) do
begin
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
Result := (Lum > 30.0);
if (Result) then
begin
WriteLn(Lum);
MouseBox(B.X1, B.Y1, B.X2, B.Y2, 3);
Wait(500 + Random(500));
end;
end;
end;

I've searched for the max luminance in the box around the spell and I've checked if its above a certain value (I've set this to 30.0). Hasn't been widely tested yet though.


i will test it for you

~shut