Non-threaded

Forums » Writing Workshop » Read Thread

Find proofreaders here, useful resources, and share opinions and advice on story crafting.

Building a five pin pass code into your game

6 years ago

Building a five pin pass code into your game

6 years ago
I think there might be an easier way to do this which needs fewer pages. I set up the numbers links (%CHAR variables) which link back to the same page, then an 'Enter' and a 'Clear' link. Then I put this in each link script (changing the numbers for each %CHAR variable):

IF %CHAR4 > 0 THEN %CHAR5:= X
ELSE IF %CHAR3 > 0 THEN %CHAR4:= X
ELSE IF %CHAR2 > 0 THEN %CHAR3:= X
ELSE IF %CHAR1 > 0 THEN %CHAR2:= X
ELSE %CHAR1:= X

Where X corresponds to the number chosen. Then this in the 'Enter' link:

IF
%CHAR1 = A THEN
BEGIN
IF %CHAR2 = B THEN IF %CHAR3 = C THEN IF %CHAR4 = D THEN IF %CHAR5 = E THEN $DEST:= @PY
END
ELSE $DEST:= @PZ

Where @PZ is the passcode fail page and @PY leads to the correct passcode page. Other letters are numbers of choice for the passcode.

EDIT: Just realised this isn't perfect because someone can enter the wrong code, but if they get the first number (A) right then the code doesn't run and it takes you to whatever page the link actually goes to. However, can fix this by setting the enter link to the page which tells you that the passcode is wrong.

Building a five pin pass code into your game

6 years ago
Yeah, there is an easier way or two, but I don't have either of those wrote up haha!