Revealing a name and adding it to a description.

DarksDaemon
07 Dec 2012, 22:47
I'm wondering if it's possible and how I would have a room description that changes after a player has looked at an object.

i.e.
Look

There is a large anvil with a goblin hard at work.

Look at goblin

The goblin is wearing a name-tag, it reads 'Murray'

Look

There is a large anvil Murray is hard at work.

sgreig
08 Dec 2012, 04:04
There would be two steps to accomplishing this. Firstly, you'd want to have a script that sets a flag when the player looks at the goblin. For example, goblin.lookedAt = true or something like that.

Next, you'd want to change the room description from text to script, and have a script something similar to the following:


if (goblin.lookedAt = true) {
msg("There is a large anvil. Murray is hard at work.")
}
else {
msg("There is a large anvil with a goblin hard at work.")
}


Obviously you would need to change it to reflect the names of the objects in your game, but that should give you a good jumping off point. If you need more help with it, let us know. :)

DarksDaemon
08 Dec 2012, 20:01
Thanks for the quick concise answer, I've got it running now, I missed the parts about flags in the tutorials and the wiki search didn't really help at all.

Thanks again.

sgreig
10 Dec 2012, 09:37
Glad I could be of assistance. :D