17-02-2007, 03:42 PM
Well I was doing the tutorial called Achieving urber speed, and I got to the point where i have to change the Load Classes sub.
in the tutorial It says
The problem here is that The tutorial does not explain how to change the getvar stuff. It just says to change them with the Get #nFileNum, ,Max_Classes, which always throws an error.
I did mine like this how would you do this?
Code:
Sub Load Classes()
Dim FileName As String
Dim i As Long
Dim nFileNum As Integer
nFileNum = FreeFile
Open FileName For Binary As #nFileNum
Call CheckClasses
FileName = App.Path & "\data\classes.bin"
Max_Classes = Val(GetVar(FileName, "INIT", "MaxClasses"))
ReDim Class(0 To Max_Classes) As ClassRec
Call ClearClasses
For i = 0 To Max_Classes
Class(i).Name = GetVar(FileName, "CLASS" & i, "Name")
Class(i).Sprite = GetVar(FileName, "CLASS" & i, "Sprite")
Class(i).STR = Val(GetVar(FileName, "CLASS" & i, "STR"))
Class(i).DEF = Val(GetVar(FileName, "CLASS" & i, "DEF"))
Class(i).SPEED = Val(GetVar(FileName, "CLASS" & i, "SPEED"))
Class(i).MAGI = Val(GetVar(FileName, "CLASS" & i, "MAGI"))
DoEvents
Next i
End Sub
in the tutorial It says
Code:
Then instead of GetVar, replace it with the Get statement, Get #nFileNum, ,Max_Classes
Replace all the other GetVar stuff with the Get stuff.
Close the file at the end, Close #nFileNum
The problem here is that The tutorial does not explain how to change the getvar stuff. It just says to change them with the Get #nFileNum, ,Max_Classes, which always throws an error.
I did mine like this
Code:
Class(i).Name = [color=red]Get[/color] #nFileNum, ,Max_Classes