How to make digging with spade in certain locations produce items
NecroDeath
15 Sept 2016, 16:58I have a garden and a shed containing a spade in my game. I want an item to appear (made visible) in garden if you dig there (but only once!), but not produce item if you dig anywhere else (well maybe one more location)
NecroDeath
15 Sept 2016, 17:04It's the only once bit that it causing me trouble, the spade shouldn't reveal anything after the 1st time you dig in the garden

Father
15 Sept 2016, 19:18Try
Create spade, hole , object of search.
Go to spade Set up verb dig ; dig hole; dig ground; dig garden
If player is in room garden
Print You dig
make visible hole( previously placed in garden invisible)
Hole is open container containing object( hidden until looked at)
Or you could just make the object appear after digging if it's simpler
Else
You feel that this is the wrong place to dig( or something similar)
If the player digs again in garden he will get message."You dig" there will already be a hole and if the object has been taken, nothing else.
hegemonkhan
15 Sept 2016, 23:21in code, using a Command, for an example:
<command name="dig_command">
<pattern>dig</pattern>
<script>
if (not spade.parent = player) {
msg ("Unfortunately, you need a spade, in order to be able to dig.")
} else if (player.parent = garden) {
firsttime {
NAME_OF_YOUR_ITEM.visible = true
msg ("You discover the " + NAME_OF_YOUR_ITEM.name_OR_alias + " from your digging!")
} otherwise {
msg("You've already previously digged in the garden, you're not going to find anything else in the garden")
if (NAME_OF_YOUR_ITEM.parent = garden) {
msg ("(Hopefully this time) you notice the " + NAME_OF_YOUR_ITEM.name_OR_alias + ", which you had dug up the first time, but failed to notice it.")
}
}
} // etc 'else ifs' and/or 'else', if you want to handle other events/rooms/etc, (if you want to require other digging tools for events, you'll need to adjust the code design a bit for handling it correctly)
</script>
</command>
NecroDeath
18 Sept 2016, 12:44Thank you!