Mirage Engine
binary classes - Printable Version

+- Mirage Engine (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: binary classes (/showthread.php?tid=1898)



binary classes - Ligaman - 08-07-2008

I have problem with my binary classes , i got that error "wrong number of arguments or invalid property assignment" and highlights FileExist on saveclasses sub.
Here is my code:

loadclasses sub
Code:
Sub LoadClasses()
Dim FileName As String
Dim i As Long
Dim nFileNum As Integer

    Call CheckClasses
    
    FileName = App.Path & "/classes.fcl"
    
    nFileNum = FreeFile
    Open FileName For Binary As #nFileNum
    
    Get #nFileNum, , Max_Classes
    
    ReDim Class(0 To Max_Classes) As ClassRec
    
    Call ClearClasses
    
    For i = 0 To Max_Classes
        Get #nFileNum, , Class(i)
        If (i Mod 5) = 0 Then DoEvents
    Next i
    
    Close #nFileNum

End Sub

saveclasses

Code:
Sub SaveClasses()
Dim FileName As String
Dim i As Long
Dim nFileNum As Integer

    FileName = App.Path & "\classes.fcl"
    
    nFileNum = FreeFile
    If FileExist(FileName, True) Then Kill FileName
    Open FileName For Binary As #nFileNum
    
    Put #nFileNum, , Max_Classes
    
    For i = 0 To Max_Classes
        Put #nFileNum, , Class(i)
    Next i
    
    Close #nFileNum

End Sub

checkclasses

Code:
Sub CheckClasses()
    If Not FileExist("\classes.fcl") Then
        Call ClearClasses
        Call SaveClasses
    End If
End Sub



Re: binary classes - Dragoons Master - 08-07-2008

It's exacly what it says...
"wrong number of arguments or invalid property assignment"
Wrong number of arguments... There is needed only one argument not two, remove that ", True"...


Re: binary classes - Ligaman - 08-07-2008

now i have RTE 52 in this
Code:
Function FileExist(ByVal FileName As String) As Boolean
    If Dir(App.Path & "\" & FileName) = "" Then
        FileExist = False
    Else
        FileExist = True
    End If
End Function



Re: binary classes - Dragoons Master - 08-07-2008

At SaveClasses sub, replace "FileName = App.Path & "\classes.fcl"" with "FileName = App.Path & "classes.fcl""
Just remove the \, the function already adds it so your making a double \(\\)


Re: binary classes - Ligaman - 08-07-2008

still the same problem RTE 52"bad file or number" i also removed the / in loadclasses and checkclasses but same problem,,,


Re: binary classes - Dragoons Master - 09-07-2008

No... only one of them...
If that doesn't work, well...
Oh, just saw... remove the App.Path from the "FileName = App.Path & "/classes.fcl""
Just use:
FileName = "classes.fcl"
That's how the function works


Re: binary classes - Ligaman - 09-07-2008

Thanks it works i dont have an error server loads normally.Should i change the loadclasses as well?


Re: binary classes - Dragoons Master - 09-07-2008

It will probably bug too...