[Codesnip] Password for a level idenification
Posted: Fri Apr 04, 2008 1:06 pm
Only a simple example:
Code: Select all
;
; Password for a level idenification
;
#maxLevel = 100
; Get the corresponding Level from Password
Procedure.l CreateLFP(sPWD$)
For nl = 1 To #maxLevel
RandomSeed(nl)
retPWD$ = ""
For n = 1 To 5
retPWD$ + Chr(Random(25)+65)
Next n
If retPWD$ = sPWD$
ProcedureReturn nl
EndIf
Next nl
ProcedureReturn -1
EndProcedure
; Create a corresponding Password for Level
Procedure.s CreatePFL(lLevel)
RandomSeed(lLevel)
For n = 1 To 5
retPWD$ + Chr(Random(25)+65)
Next n
ProcedureReturn retPWD$
EndProcedure
;
; Example
;
pwd.s = CreatePFL(10)
Debug "Password for Level 10: " + pwd
MessageRequester("","Password for Level 10: " + pwd)
pwd = InputRequester("Input password for level.","Enter password (Default: Level 1):", CreatePFL(1))
MessageRequester("","You start with level: " + Str(createLFP(pwd)) + " now.")