So I have an array of records called Prayer, inside of the record prayer is the following things:
Simba Code:
type Prayers = record
Location:TPoint;
name, info:string;
level:Integer;
Exceptions:TIntegerArray;
end;
Location is the row and column, name, info, level are all pretty obvious, and exceptions is a tintegerarray of all prayers that cannot be turned on at the same time as that one. for example the exceptions for protect from melee would be the prayer id for prot mage, range, retribution, smite, and redemption as shown here:
Simba Code:
with Prayer[19] do
begin
Location := Point(3, 4);
name := 'Protect from melee';
info := 'Decreases NPC melee damage by 40%';
Exceptions := [17, 18, 22, 24];
level := 43;
end;
In my form, I am trying to make it idiot proof and not letting people add prayers to the list if they can't have it on (such as selection chivalry and piety). How I am trying to do this:
-When the user clicks the "add prayer" button, it goes to "updateprayer" procedure, this procedure then gets the TList item index, and then does a for loop for the prayers selected, and inside of that for loop does another for loop for each prayer that is selected Exceptions list. This is were I am getting the type mismatch.. please ignore the sloppy code I am just trying to get it working before cleaning it up
Simba Code:
procedure UpdatePrayerList(sender:TObject);
var
i, l:Integer;
begin
Writeln(Prayer[0].Exceptions[0]);
case sender of
FormData.PrayButtons[0]:
begin
if not IntInArray(FormData.Options[4].ItemIndex, PrayUse) then
begin
if not IntInArray(FormData.Options[4].ItemIndex, Prayer[FormData.Options[4].ItemIndex].exceptions) then
begin
for i := 0 to high(PrayUse) do
begin
for l := 0 to high(Prayer[PrayUse[i]].Exceptions) do
begin
if (Prayer[FormData.Options[4].ItemIndex] = Prayer[PrayUse[i]].Exceptions[l]) then
error('You can not use ' + Prayer[FormData.Options[4].ItemIndex].name + ' and ' Prayer[Exception[l]].name + ' at the same time!');
end;
end;
TIAAppend(PrayUse, FormData.Options[4].ItemIndex);
FormData.Chosen[4].ITEMS.Clear;
for i := 0 to high(prayUse) do
FormData.Chosen[4].ITEMS.Add(Prayer[PrayUse[i]].name);
end;
end else if IntInArray(FormData.Options[4].ItemIndex, PrayUse) then
begin
error('You already added that Prayer!');
end;
end;
end;
end;
The error falls at this line -->
Simba Code:
if (Prayer[FormData.Options[4].ItemIndex] = Prayer[PrayUse[i]].Exceptions[l]) then
Help would be appreciated, I can post the whole script if needed (is pretty long so I don't want to if I don't have to)
Script: