Mirage Engine
Problem with Binary.. - 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: Problem with Binary.. (/showthread.php?tid=470)



Problem with Binary.. - Matt - 13-12-2006

I recently added the binary accounts tut that Dave posted. I can create an account and login, but I can not create an account. For some reason, when creating an account it saves it as \accounts\advocate.doa but when I create a character, it does not pass the login name, so I end up getting my character in a file named like this:

\accounts\.doa

I can not figure out for the life of me what's wrong with it.

Any help would be much appreciated.


- Tony - 13-12-2006

Hmmph can you update me on what you've updated so far with binary technique?

:: Pando


- Matt - 13-12-2006

SavePlayer, LoadPlayer, AccountExist, PasswordOK.

I think that's it.

AccountExist, I just updated the file type from ini to doa.


- Tony - 13-12-2006

Hmmph you should try testing if inputting anything into login username & password works. If so its most likely your PasswordOK sub.

Here you go:
Code:
Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String
Dim RightPassword As String * NAME_LENGTH
Dim nFileNum As Integer

    PasswordOK = False
    
    If AccountExist(Name) Then
        FileName = App.Path & "\Accounts\" & Trim$(Name) & ".dat"
        nFileNum = FreeFile
        Open FileName For Binary As #nFileNum
        
        Get #nFileNum, 20, RightPassword
        
        Close #nFileNum
        
        If UCase$(Trim$(Password)) = UCase$(Trim$(RightPassword)) Then
            PasswordOK = True
        End If
    End If
    
End Function

:: Pando


- Matt - 13-12-2006

That's how mine looks, aside from it being \data\accounts\

I'm thinking it's SavePlayer. But I can't find anything wrong with it.


- Tony - 13-12-2006

Ill give you the slight bit of my sub.

Code:
Sub SavePlayer(ByVal index As Long)
Dim FileName As String
Dim i As Long
Dim n As Long
Dim nFileNum As Integer

    FileName = App.Path & "\Accounts\" & Trim$(Player(index).Login) & ".dat"
    
    If FileExist(FileName, True) Then Kill FileName
    nFileNum = FreeFile
    Open FileName For Binary As #nFileNum

If you just modified those subs, I really don't understand what the problem could possibly be.

CAPS: SINCE YOU CHANGED IT TO DATA/ACCOUNTS/FILENAME.DOA MAKE SURE YOU UPDATE ACCOUNTEXIST AND ETC.

:: Pando


- Obsidian - 13-12-2006

I'm working with him right now... it should be completely working soon. No worries. Smile

[Edit]
2 Minutes Later........ Working.... :lol:


- pingu - 13-12-2006

Obviously, "Trim$(Player(index).Login)" is returning null for some reason.


- Matt - 13-12-2006

Lol. It was an idiot move on my behalf. I currently cleaned everything up, and moved everything inside a data folder. I forgot to add the /data in front of the /accounts in sub LoadPlayer. Lol.


- Tony - 13-12-2006

Obsidian Wrote:I'm working with him right now... it should be completely working soon. No worries. Smile

[Edit]
2 Minutes Later........ Working.... :lol:

:O! But but but but but I edited my post before and.. NVM lol
your good Obsidian.

:: Pando


- Obsidian - 13-12-2006

Haha, thanks pando.

Yeah they were a couple of simple mistakes, but he's got it working now. All is well.


By the way, pingu, it was returning null, because he didn't set the correct filename path in the loadplayer sub.