SRL Archive - OSR Help

Type mismatch error ??


Troll

2011-08-08 09:18:43

Ok so sorry for all my questions i have been asking :( But i cant under stand why i am getting this error. The error is


[Error] (84:19): Type mismatch at line 83
Compiling failed.

the function is


Function FindMonster(ID:integer; TheName:String):Boolean;
Var
MonsterArray :TNPCArray;
MyPoint :TPoint;
I,x,y :Integer;
Begin

If R_FindNPCs(ID,False,MonsterArray) Then
Begin
MonsterArray := R_SortNPCs(MonsterArray)
For I := 0 To High(MonsterArray) Do
If Not MonsterArray[I].InCombat Then
If Not R_Animating Then
Begin
If R_TileOnMS(MonsterArray[I].Tile,0) Then
Begin
MyPoint := R_TileToMS(MonsterArray,0)
MMouse(MyPoint.x,MyPoint.y,RandomRange(-3,3),RandomRange(-3,3));
If WaitUptext(TheName,1200) Then
If Random(20) = 5 Then
Begin
GetMousePos(x,y);
Mouse(x,y,0,0,False);
If WaitOption('Attack') Then
Begin
Result := True
TrollWait(RandomRange(100,1000));
Exit;
End;
End Else Begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
Result := True
TrollWait(RandomRange(100,1000));
Exit;
End;
End;
End;
End;
End;

the line is the middle one


MyPoint := R_TileToMS(MonsterArray,0)
MMouse(MyPoint.x,MyPoint.y,RandomRange(-3,3),RandomRange(-3,3));
If WaitUptext(TheName,1200) Then

how ever if i coment out the top line i dont get that error?

Thanks for any help and sorry for all the questions

Flight

2011-08-08 09:50:26

Your real 'Type mismatch' is this line: "MyPoint := R_TileToMS(MonsterArray,0)"

Here's the function for TileToMS:


function R_TileToMS(TheTile: TTile; height : integer) : TPoint;
begin
result:= R_TileToMSEx(TheTile, 0.5, 0.5, height);
end;

So your input, for this function, would be (Tile, height). You have (TNPCArray, height), so there's your mismatch.

See this line? "If R_TileOnMS(MonsterArray.Tile,0) Then" You had that one right, just do the same thing for line 83/84 (whichever it is) and you're problem is history. ;)

Troll

2011-08-08 10:28:06

Stupid me thanks flight

Nava2

2011-08-08 17:30:49

Also, your standards are very hard to read.. kinda OT. But, you only indent on new groups.

Ex:

if (not Here) then
begin
if (not There) then
begin
DoThat;
end;
end;