Jump to content

Recommended Posts

Posted

MAJOR EDIT: I found out how to get what I wanted (a lock on a computer that utilized multiple passwords and different actions depending on which passwords are input). Here's the code:

You'll need to make some commands:

: STRING

32 ALLOT

SWAP

!

;

: SET

@ 32 CR ." : " ACCEPT

CR

;

: PRINT

@ CR ." '" TYPE ." '"

CR

;

Then, the variables you're gonna need and set them up with a string:

VARIABLE PASS1

PASS1 STRING

VARIABLE PASS2

PASS2 STRING

VARIABLE TEMP

TEMP STRING

In order to set your passwords you're going to need to use "PASS1 SET" or "PASS2 SET" then input the password and hit enter.

This is the program:

: LOCK

BEGIN

PAGE

." Password : " CR

TEMP SET

PASS1 @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Access Granted."

1 IOX!

80 TICKS

0 IOX!

ELSE

PASS2 @

TEMP @

STRCMP

0

= IF

PAGE

CR CR ." Access Granted."

2 IOX!

80 TICKS

0 IOX!

ELSE

PAGE

CR CR ." Access Denied! "

80 TICKS

THEN

THEN

AGAIN

;

All you have to do is type "LOCK" into the console to activate the program. If you'd like to set up one of the passwords (or simply a third password) that can access the console and all other commands again, say, for example, to make changes to your passwords, then all you have to do is, instead of:

1 IOX!

80 TICKS

0 IOX!

Do:

EXIT

And then you will be able to use the console as normal, assuming you get the password right.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...