Safe Box - In game PASSWORD

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Greenyel
Slime
Posts: 23
Joined: Mon Jan 16, 2017 2:58 pm
Location: Tubarao/SC - Brazil

Safe Box - In game PASSWORD

Post by Greenyel »

Hello!

I would like to make a password protected safe box. The player would have to enter the correct password by typing on the keyboard.

Now, I imagine that it would be necessary to use strings. Since I did not find anything specifically on the wiki about this, I came here to ask for help. I've already read everything about strings I found (plotdictionary, wiki, slimesalad ...). But as I have little experience with plostscripts, I could not really understand how to do this...

The idea would be that if the player wrote the correct password the safe will open and he would receive the item. Otherwise a message appears saying that the password was incorrect.

I think the command to be used here could also be used on an NPC I would like to do. The NPC would ask a question and the player would need type on the keyboard the answer. If he writes "CASH", the player receives a certain amount. If he writes "ITEM", he receives a quest item, and in case he writes something else the NPC enters into battle against the hero.
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Code: Select all

plotscript, check for passcode, begin
  # This script lets the player input string ID 0, and uses string ID 1 for comparisons
  $0="" 
  input string(0, 4)
  if(string compare(0, $1="CASH")) then(
    # stuff that only happens if you input CASH
  )else if(string compare(0, $1="ITEM")) then(
    # stuff that only happens if you input ITEM
  )else(
    # stuff that happens for any other input string
  )
end
Try this script out. It should be a decent base to start from.

You will probably want "show text box" commands in each of the "# stuff that only happens..." sections.
Post Reply