Mirage Source http://miragesource.net/forums/ |
|
[RESOLVED] RTE 13 Type Mismatch http://miragesource.net/forums/viewtopic.php?f=201&t=3052 |
Page 1 of 1 |
Author: | wisefire [ Sun Nov 18, 2007 5:10 am ] |
Post subject: | [RESOLVED] RTE 13 Type Mismatch |
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. :) |
Author: | Lea [ Sun Nov 18, 2007 5:20 am ] |
Post subject: | Re: RTE 13 Type Mismatch |
Well, classes are essentially races... You want to do like... Race: Orc Elf Human and Class: Knight Mage Barbarian So you could have an Orc Knight, or a Ork Mage, or a Elf Knight, each with different stats? Honestly, I would just make a different class for each. |
Author: | Rian [ Sun Nov 18, 2007 8:22 am ] |
Post subject: | Re: RTE 13 Type Mismatch |
Make sure you defined .Sprite in the Race Rec |
Author: | William [ Sun Nov 18, 2007 10:07 am ] |
Post subject: | Re: RTE 13 Type Mismatch |
Make sure .Sprite is either a byte or a long. Try adding val(), Int() or CInt() to your getvar. |
Author: | Lea [ Sun Nov 18, 2007 3:31 pm ] |
Post subject: | Re: RTE 13 Type Mismatch |
William wrote: Make sure .Sprite is either a byte or a long. Try adding val(), Int() or CInt() to your getvar. Yeah, that's the problem. You're trying to store a string into a integer value. CInt() will turn it to an int. |
Author: | wisefire [ Sun Nov 18, 2007 3:51 pm ] |
Post subject: | Re: RTE 13 Type Mismatch |
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. |
Author: | William [ Sun Nov 18, 2007 5:01 pm ] |
Post subject: | Re: RTE 13 Type Mismatch |
Check so your FileName = App.Path & "\races.ini" is correct. And check that you actually have [Race] and Sprite= in the races.ini |
Author: | Matt [ Sun Nov 18, 2007 5:02 pm ] |
Post subject: | Re: RTE 13 Type Mismatch |
In other words, make sure you called putvar to actually place something in the file. |
Author: | wisefire [ Sun Nov 18, 2007 5:04 pm ] |
Post subject: | Re: RTE 13 Type Mismatch |
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!!!! |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |