SRL Archive - OSR Help

Internal error?


Troll

2011-07-23 11:53:42

So again i have a problem and im asking for help. I get an error message thats says



[Error] (45:48): Internal error (20) at line 44
Compiling failed.


And the function is


Function FindFight(MonsterName:string):Boolean;

Var
AllNPCs,RightNPC :TNPCArray;
TheMonster :MonsterData;
I,a :Integer;
PointI:TPoint;

Begin

AllNPCs := R_GetAllNPCs(False);
TheMonster := WhatMonsterData(MonsterName);

For I := High(AllNPCs) Downto 0 Do
If (AllNPCs[I].ID = TheMonster.ID) Then
RightNPC[(High(RightNPC)+1)] = AllNPCs[I];

For I := High(RightNPC) Downto 0 Do
R_SortNPCs(RightNPC);

For I := 0 To High(RightNPC) Do
If RightNPC[I].InCombat Then
If R_TileOnMM(RightNPC[I]) Then
Begin
PointI := R_TileToMM(RightNPC[I]);
MMouse(PointI.x,PointI.y,4,4);
If WaitUptext(TheMonster.Name,2000) Then
Begin
GetMousePos(x,y);
If Random(20) = 5 Then
Begin
Mouse(x,y,0,0,False);
If WaitOption('Attack',2000) Then
Begin
Result := True
Exit;
End;
End Else Begin
Mouse(x,y,0,0,True);
Result := true;
Exit;
End;
End;
End;
End;

Thanks for any help, i hope to finish atleast one script by the end of summer im getting really annoyed at not even finishing my first script.

Thanks

Flight

2011-07-23 12:34:11

Post line 43 and 44. Not of the function, of the whole script.

Geo

2011-07-23 12:58:44

You had a begin/end in the wrong place.


Function FindFight(MonsterName:string):Boolean;

Var
AllNPCs,RightNPC :TNPCArray;
TheMonster :MonsterData;
I,a :Integer;
PointI:TPoint;

Begin

AllNPCs := R_GetAllNPCs(False);
TheMonster := WhatMonsterData(MonsterName);

For I := High(AllNPCs) Downto 0 Do
If (AllNPCs[I].ID = TheMonster.ID) Then
RightNPC[(High(RightNPC)+1)] = AllNPCs[I];

For I := High(RightNPC) Downto 0 Do
R_SortNPCs(RightNPC);

For I := 0 To High(RightNPC) Do
If RightNPC[I].InCombat Then
If R_TileOnMM(RightNPC[I]) Then
Begin
PointI := R_TileToMM(RightNPC[I]);
MMouse(PointI.x,PointI.y,4,4);
If WaitUptext(TheMonster.Name,2000) Then
Begin
GetMousePos(x,y);
If Random(20) = 5 Then
Begin
Mouse(x,y,0,0,False);
If WaitOption('Attack',2000) Then
Begin
Result := True
Exit;
End;
End Else //no need for a begin here.
Mouse(x,y,0,0,True);
Result := true;
Exit;
End;
End;
End;