4 digit code

I’m new to quest and I was trying to make it so that the player has to type in a 4 digit code to unlock an exit, can anybody help?


We have a guide for doing just that (well, a locked box, not an exit, but nearly the same):
http://docs.textadventures.co.uk/quest/guides/unlockdoor.html


code=GetRandomInt(0,9999)
but you get numbers like "12", or "199"
if you want 4 digit, you could...
code=right("0000" & code,4)
to get "0012" or "0199"
Option 2:
C1=GetRandomInt(0,9)
C2=GetRandomInt(0,9)
C3=GetRandomInt(0,9)
C4=GetRandomInt(0,9)
Code=C1 & C2 & C3 & C4
that should give you "0000" to "9999"


Easier to do:

code=GetRandomInt(1000,9999)

No one will play it enough to realise the lower numbers are missing.


Log in to post a reply.

Support

Forums