| Mirage Source http://miragesource.net/forums/ |
|
| Trying to convert to binary... Small bug http://miragesource.net/forums/viewtopic.php?f=201&t=344 |
Page 1 of 11 |
| Author: | Krloz [ Tue Aug 01, 2006 4:55 pm ] |
| Post subject: | Trying to convert to binary... Small bug |
I guess theres a bug I can succesfully create an account with no problem but when I try to login it says wrong password Heres my Passwordok function Code: Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String 'Dim RightPassword As String Dim RightPassword As String * NAME_LENGTH Dim nFileNum As Integer PasswordOK = False If AccountExist(Name) Then nFileNum = FreeFile Open FileName For Binary As #nFileNum FileName = App.Path & "\Accounts\" & Trim(Name) & ".zap" Get #nFileNum, 20, RightPassword '= nFileNum.Password RightPassword = Player(Index).Password If UCase(Trim(Password)) = UCase(Trim(RightPassword)) Then PasswordOK = True End If End If End Function I been trying alot to make it load right but I cant make it work >.< |
|
| Author: | Anthony [ Tue Aug 01, 2006 5:35 pm ] |
| Post subject: | |
I had a similar problem, try removing the Code: RightPassword = Player(Index).Password
|
|
| Author: | Krloz [ Tue Aug 01, 2006 7:26 pm ] |
| Post subject: | |
Commented it before didnt work. |
|
| Author: | Spodi [ Tue Aug 01, 2006 11:21 pm ] |
| Post subject: | |
Heres a little debugging hint - try putting stoppers (click the left side of the screen and place the dot on the line) then when the code stops at that line, move the mouse over certain variables to see if they are what they should be. One good place to check is the password you are recieving. Hope that helps! |
|
| Author: | Misunderstood [ Wed Aug 02, 2006 12:58 am ] |
| Post subject: | Re: Trying to convert to binary... Small bug |
Code: Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String 'Dim RightPassword As String Dim RightPassword As String * NAME_LENGTH Dim nFileNum As Integer PasswordOK = False If AccountExist(Name) Then nFileNum = FreeFile Open FileName For Binary As #nFileNum FileName = App.Path & "\Accounts\" & Trim(Name) & ".zap" Get #nFileNum, 20, RightPassword '= nFileNum.Password RightPassword = Player(Index).Password If UCase(Trim(Password)) = UCase(Trim(RightPassword)) Then PasswordOK = True End If End If End Function Tell me...why are you setting the file name after you need to open it using the filename? that doesn't seem smart. nor like that would even work as for rightpassword = player(index).password. You are doing this before you load the entire account, therefore the player rec won't have any data in it. not to mention that the sub doesn't even know what index is. its not passed(nor should it be). You're also assuming rightpassword is 20 bytes from the start of the file. Is that still true(it might have been true for the person writing the tutorial, but you're game could be different) |
|
| Author: | Krloz [ Thu Aug 03, 2006 12:20 am ] |
| Post subject: | |
Ok Tried different things I still couldnt get it to work <.< any other hints? Code: Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String 'Dim RightPassword As String Dim Rightpassword As String * NAME_LENGTH Dim nFileNum As Integer FileName = App.Path & "\Accounts\" & Trim(Name) & ".zap" PasswordOK = False 'If AccountExist(Name) Then nFileNum = FreeFile Open FileName For Binary As #nFileNum Get Trim(Name), , Rightpassword '= nFileNum.Password Password = Rightpassword Rightpassword = Player(Index).Password ' Password = Rightpassword 'RightPassword = Player(Index).Password If UCase(Trim(Password)) = UCase(Trim(Rightpassword)) Then If AccountExist(Name) Then PasswordOK = True End If End If End Function |
|
| Author: | Liz [ Thu Aug 03, 2006 12:25 am ] |
| Post subject: | |
When you save the accounts, do you use. Code: Put CharName, , RightPassword
CharName of course might be different, but the RightPassword part. |
|
| Author: | Misunderstood [ Thu Aug 03, 2006 2:44 am ] |
| Post subject: | |
Code: Get Trim(Name), , Rightpassword by leaving it blank, you don't know where it is taking it from(probably from the start of the file)...noooooo....tell it what to do!!! Code: Password = Rightpassword Why?! Password is what they guessed! Code: Rightpassword = Player(Index).Password
you dont even know what index is!, the player hasn't been loaded! noo! baddd! |
|
| Author: | Lea [ Thu Aug 03, 2006 5:20 am ] |
| Post subject: | |
Code: Function PasswordOK(ByVal Name As String, ByVal Password As String) As Boolean
Dim FileName As String Dim RightPassword As String * NAME_LENGTH 'An empty string of the right length, this lets us pull the right ammount of bytes without using a byte array.... easy peasy Dim nFileNum As Integer PasswordOK = False 'Set it to false incase there's an error If AccountExist(Name) Then 'If the account is there... FileName = App.Path & "\Accounts\" & Trim$(Name) & ".vac" nFileNum = FreeFile Open FileName For Binary As #nFileNum 'Open the file Get #nFileNum, 20, RightPassword 'Pull the password from the binary encoded file. The password's first letter starts on byte 20. I know this because I know how the file was saved... it may be different for you. Because RightPassword is a fixed length string, it will pull the next 20 bytes out automaticly. For more information about how this works, see my binary tutorials Close #nFileNum 'Dont leave files open... If Trim$(Password) = Trim$(RightPassword) Then 'compare... Mine is case sensitive, add UCase$ or LCase$ to make it not. PasswordOK = True End If End If End Function Code ripped from Valkorian, comments added on the spot by yours truely... Dave~ PS: I FIXED MY COMPUTER AN DI GOT EVERYTHING BACK YAYYYS! |
|
| Author: | Krloz [ Fri Aug 04, 2006 12:54 am ] |
| Post subject: | |
oK ill try it later school started and I cant be on pc >,> all I can do is homework =( |
|
| Author: | Lea [ Fri Aug 04, 2006 1:31 am ] |
| Post subject: | |
o-o where do you live? |
|
| Author: | Krloz [ Fri Aug 04, 2006 6:57 pm ] |
| Post subject: | |
I live in mexico im in high school and we started 2 days ago 7am to 3pm is the time I have to be in school but its worth it because I leave as a profesionist |
|
| Author: | Misunderstood [ Fri Aug 04, 2006 7:02 pm ] |
| Post subject: | |
well its not like...oh poof im professional right when you get out of school And those are about the same hours you have that we have for school(though school doesnt start till the begining of september for me) |
|
| Author: | Robin [ Fri Aug 04, 2006 7:23 pm ] |
| Post subject: | |
7am!? If we had school at 7am I would have to get up at... at... 5am!! :O We have school at about 8:30, but I need to get two trains to get there. |
|
| Author: | Mithlomion [ Fri Aug 04, 2006 7:28 pm ] |
| Post subject: | |
Kite wrote: 7am!?
If we had school at 7am I would have to get up at... at... 5am!! :O We have school at about 8:30, but I need to get two trains to get there. Two Trains? How a terrible way of starting the day... xD. My Schools like 30 meter from my home. |
|
| Author: | Robin [ Fri Aug 04, 2006 8:31 pm ] |
| Post subject: | |
Lucky :S But I do get a chance to grab a Latté whilst switching trains so it's not all bad. Anyway, tell us if you manage to sort out your problem! |
|
| Author: | Lea [ Fri Aug 04, 2006 9:00 pm ] |
| Post subject: | |
my school is a 15 minute car ride, or a 25 minute bus ride. I get up at 6:00 in the morning, get to school at 7:00 and school officially starts at 7:25. yay wisconsin! |
|
| Author: | Gilgamesch [ Fri Aug 04, 2006 9:33 pm ] |
| Post subject: | |
Dave wrote: my school is a 15 minute car ride, or a 25 minute bus ride. I get up at 6:00 in the morning, get to school at 7:00 and school officially starts at 7:25.
yay wisconsin! i have to walk to school ^^, i get up at 6:50, leave my house at 7:30 and school starts at 8:05, so 35 mins way :/ |
|
| Author: | Misunderstood [ Fri Aug 04, 2006 11:56 pm ] |
| Post subject: | |
Quote: my school is a 15 minute car ride, or a 25 minute bus ride. I get up at 6:00 in the morning, get to school at 7:00 and school officially starts at 7:25.
yay wisconsin! Wow its the same here, though I wake up 15 minutes later and get to school 15 minutes later...but I think it starts at 7:25. Oh, and I'm in a good state xD |
|
| Author: | Krloz [ Sat Aug 05, 2006 1:56 am ] |
| Post subject: | |
Thread went a bit offtopic xDDD Well I got it working now when I try to change the classes I get a bug I think i will leave it for another time for now I think the accs are only the binary thing needed |
|
| Page 1 of 11 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|