Change description

I want to do something that the first time you click "look at" for an NPC it says something, but the second time you click it, it changes the description or the verb "look at" for the rest of the game to a different description

In this case you don't need to change the description. You can set a description that displays different text the first time it is shown using text processor directives.

Within any text that is sent to the output, you can include something like {once:This text will only appear the first time}{notfirst:This text won't appear the first time}

For example, an NPC's description might be:

{once:A skinny old man leans against the fence. }He's chewing a piece of straw. He {notfirst:still }looks angry.

The first time you look at him, it would say "A skinny old man leans against the fence. He's chewing a piece of straw. He looks angry.", and the second and subsequent times you look, it will say "He's chewing a piece of straw. He still looks angry."

If you decide that you do want to change someone's description after a certain event, you would use a command something like:

john.look = "John has a bandage wrapped around his head where you hit him, and he looks even angrier than before."

The look attribute stores the description for when you look at an object, and you can set it to either a script or a string. You can also include text processor directives inside the description.

This method is more efficient than using text processor commands, but if you want to change a description based on more than one condition, the text processor can make your code a lot easier to manage.

Log in to post a reply.