Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[RESOLVED] RTE 13 Type Mismatch
#1
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. :)
Reply
#2
Make sure you defined .Sprite in the Race Rec
Reply
#3
Make sure .Sprite is either a byte or a long.

Try adding val(), Int() or CInt() to your getvar.
Reply
#4
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.
Reply
#5
Check so your FileName = App.Path & "\races.ini" is correct.

And check that you actually have [Race] and Sprite= in the races.ini
Reply
#6
In other words, make sure you called putvar to actually place something in the file.
Reply
#7
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!!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)