"Fussy" Container

RJSRdg
21 Sept 2020, 21:38

The adventure I'm writing features a chocolate machine and a pile of pennies.

I'm trying to write a script so that if the player puts the pile of pennies in the machine, something happens, but if he tries to put anything else in, he gets the message "It won't fit in the slot."

I saw the bit in the Tutorial about how to set up a "fussy" container, which seems to be almost what I want to do, but I need a different IF statement.

I've tried

if (object.article = pile of pennies) {

with and without double quotes around "pile of pennies", but either way when I play the game and try to put the pennies in the machine, the game doesn't recognise it and instead goes to the Else clause and gives the message about them not fitting in the slot.

What have I got wrong?


mrangel
21 Sept 2020, 22:07

object.article is usually "he", "she", or "it".

What you want is probably:

if (object = pile of pennies) {

RJSRdg
21 Sept 2020, 23:47

Ah yes, that works!

Many thanks


lavernwalter
23 Sept 2020, 08:31

I see the way you shine
Take your hand, my dear, and place them both in mine run 3 hot games.


Mataeus
23 Sept 2020, 13:49

Spam alert


Mataeus
23 Sept 2020, 13:51

Sorry double post