I've got an object that I don't want to be edible, but I expect the player to try using the "eat" command on. Can I have a custom message response to this?
When I have "edible" set to "can be eaten", I have the option for "Message to print when eating (leave blank for default)". But when I set "edible" to "cannot be eaten", I have no option to change the default message.
I'm very new to making text adventure games and I can't find an answer to this on the forums.
Do you want the inedible object to do something to the player when they try to eat it.
If you have set the health option on the features tab of the main game object, then check the player tab of the main game object, you'll see the box, 'script to run when health reaches zero.', on the (in)edible object you can set a 'change health by figure'.
If you want the (in)edible object to not be eaten at all, it might be best to check 'can be eaten', have the message 'that tastes disgusting' or similar. The problem is that the (in)edible object will disappear from the room description, so you'll need to alter the eat attribute of the object in question.
Go to the 'attribute' tab of the (in)edible object, find the eat attribute and you'll need to copy it into your game, click on the eat attribute, and it will have a red box, and if you move your cursor over the box, it will ask if you want to make 'editable copy', you can now delete the last line
Destroy object expression this.name
Thank you so much for the explanation! It's very thorough and easy to follow, and answers my question perfectly.
However, I only have one problem - I can't find the "attribute" tab of the object! I have "Setup, Object, Inventory, Verbs, Features, Use/Give, Wearable, Edible, Objects", but no "attribute". What do I do?
The 'attributes' tab should be there. Try deleting the object in question, and try again. The 'attributes' tab is not something you can uncheck as far as I know, unlike the 'wearables' or 'advanced scripts' tabs.
Are you using the web editor? If so, you won't be able to see the Attributes tab.
In this case, you may be able to achieve the same effect by giving the object an "eat" verb on the verbs tab (though not sure if the editor will allow this).
If it doesn't allow you to set the verb this way, you would want to give the object an initialisation script (tick the box on the Deatures tab), and in the initialisation script put something like:
this.eat = "Your custom can't-eat message goes here."
There are a couple of features that are only available in the desktop version of the Quest editor; if you want to use them with the web editor, you'll normally need to do it using the initialisation script in this way.
@ martinnixon - Sorry, didn't realise you were using the web version.
@ mrangel - forgot there was a difference.
That works perfectly! Thank you so much, both of you! I don't have any coding experience so everything is very confusing to me right now; I'm slowly figuring it out.
I've got another problem: I want some exits to appear depending on certain actions the player takes (eg, a door only opens when the player takes a stone). How do I set this up?
Under "stone -> Inventory -> Take -> After taking the object -> Add New Script -> Objects" I can select "Unlock exit", but the exit is still unlocked when the game starts and when the player takes the stone the message "Error running script: No parameters passed to UnlockExit function - expected 1 parameters" appears.
Can you shed any light on what I'm doing wrong? How do I specify which exit? How do I lock that exit to begin with?
EDIT: I've figured this out, but I can only do it for verbs in the "verbs" tab. The player only has to get rid of the stone to open the door, so I want them to also be able to, say, eat it, or take it, and have the same result as moving it. I can't figure it out for eating. (More problems with eating!)