Locked puzzle objects
ScaryCat
09 Jan 2017, 19:50I'm trying to figure out how to use locks to make an object only open when certain things are done to it. In this case, an envelope with a wax seal. It is "locked" until you hold a candle up to the wax seal. I want to use the candle as the "key" and have it be triggered by the player typing something other than "unlock with". I'd be ok with "use candle on", but "hold candle up to wax seal" followed by "the wax melts away", and then being able to open it, would be nice. "So far it isn't working at all. I can't get any command to unlock it. Any ideas? This is my first game.
XanMag
09 Jan 2017, 20:11I would 100% use a command for this.
- Create a global command (assuming the envelope is able to move from room to room in the inventory).
- There is a fancy and simpler way to create commands lines (which I will copy-paste when I get to my home computer), but you will type something like --> hold candle up to wax seal; hold candle near wax; hold candle to wax; put flame near wax seal; put candle flame near wax; ... ... ... etc
3a. Add an 'If' script to check if the player is carrying both the candle and the envelope and
3b. If so, then print proper response and run proper scripts and
3c. If not, then print a message like "you aren't carrying the proper things to do that right now."
I'll give more details when I get home if you need them.
ScaryCat
09 Jan 2017, 20:25Thank you.
I think 3b. is where I'm especially having trouble. How do I make it unlock the object? I'm working with the web version.
XanMag
09 Jan 2017, 21:20For the "fancy" command pattern, you can type stuff like this in a command box:
^(use|hold|put|heat) (the |)(candle|flame|heat) (on|over|into|onto|near|toward) (the |)(wax|envelope|letter)
That way, you do not need to worry about a library worth of typing.
As for 3b., the first thing that comes to me is a bit of a cheat. =) I would initially consider making a room that contains "altered" objects. I have rooms in my games where I basically store items. This room has no exits or entrances. It simply is for storage. After melting the wax on the envelope, I would remove the 'envelope with wax' from the game (using 'remove object' script (or if you want to reseal the envelope, you can move the sealed envelope into the storage room)), and move the stained envelope (or whatever you want to call it) into the players inventory (using the 'move object' script). It is the illusion that the sealed envelope and the stained one are the same when in fact they are two different objects. You can put an 'open' verb on each and run scripts accordingly.
Let me know if this is the avenue you want to pursue. If not, there are alternatives to 'locking' and 'unlocking' objects. I use this ALL the time as I find it easier. Good luck!
ScaryCat
09 Jan 2017, 22:06Thank you! I'll try that and see if it works.
ScaryCat
09 Jan 2017, 23:28It worked! Thank you. I am curious too hear about the other ways of locking

Father
10 Jan 2017, 13:15Sorry to muscle in on this thread. Thanks for that imformation about fancy commands. Xanmag. That's handy. I use long winded commands all the time and did not know you could use brackets like that.
Will the command still work if the player puts in one or more words you didn't think of,.
As for the closed store room trick, I often put the changed object in the same room instead, but invisible. Provided of course the object will be changed in that room. You vanish one and show the other when needed.
The Pixie
10 Jan 2017, 14:25You could get Quest to respond to words you did not think of, a pattern can be matched to any string of letters. I am not sure that would be a good thing.
A better way to do complex commands is to match the objects, and put the synonyms in the other names list of the object (so in XanMag's example, wax, envelope and letter would be other names for the object. That way all your commands will use the same set of synonyms.
https://github.com/ThePix/quest/wiki/Using-Complex-Commands