Mirage Source
[RESOLVED] RTE 13 Type Mismatch - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: [RESOLVED] RTE 13 Type Mismatch (/showthread.php?tid=1401)



[RESOLVED] RTE 13 Type Mismatch - wisefire - 18-11-2007

Well im attempting to add Races to my game, I figured the easeist way to do it would be to base it of the class system. So I did. Now im getting this error, RTE 13 Type Mismatch;

Quote:Sub LoadRaces()
Dim FileName As String
Dim i As Long

Call CheckRaces

FileName = App.Path & "\races.ini"

Max_Races = Val(GetVar(FileName, "INIT", "MaxRaces"))

ReDim Race(0 To Max_Races) As RaceRec

Call ClearRaces

For i = 0 To Max_Races
Race(i).Name = GetVar(FileName, "RACE" & i, "Name")
Race(i).Sprite = GetVar(FileName, "RACE" & i, "Sprite")

DoEvents
Next i
End Sub

The bold red is what the error is being directed at. Now, Ive looked over everything I could think of that would be wrong, any ideas? If you need more info on the code feel free to ask. :)


Re: RTE 13 Type Mismatch - Rian - 18-11-2007

Make sure you defined .Sprite in the Race Rec


Re: RTE 13 Type Mismatch - William - 18-11-2007

Make sure .Sprite is either a byte or a long.

Try adding val(), Int() or CInt() to your getvar.


Re: RTE 13 Type Mismatch - wisefire - 18-11-2007

William Wrote:Make sure .Sprite is either a byte or a long.

Try adding val(), Int() or CInt() to your getvar.

I changed it too;

Race(i).Sprite = CInt(GetVar(FileName, "RACE" & i, "Sprite"))

and i'm still getting the error... Any Ideas?

Sonire Wrote:Make sure you defined .Sprite in the Race Rec
Yes. Ive done that.


Re: RTE 13 Type Mismatch - William - 18-11-2007

Check so your FileName = App.Path & "\races.ini" is correct.

And check that you actually have [Race] and Sprite= in the races.ini


Re: RTE 13 Type Mismatch - Matt - 18-11-2007

In other words, make sure you called putvar to actually place something in the file.


Re: RTE 13 Type Mismatch - wisefire - 18-11-2007

William Wrote:Check so your FileName = App.Path & "\races.ini" is correct.

And check that you actually have [Race] and Sprite= in the races.ini

Did that. Then changed it too;

Race(i).Sprite = Val(GetVar(FileName, "RACE" & i, "Sprite"))

And it worked!

Thanks for the help!!!!