How can I change the attributes of a character object through object scripts?

How can I change character object actions/room descriptions, "look at" descriptions, and other things, such as creating new verbs for characters, using object scripts alone? Is that possible? Or will I have to clone characters, put them in limbo, and wait for a script to switch them out for a carbon copy with new verbs and descriptions?


You can easily change an object's attributes in script. It looks something like:

object.attribute = new value

For example, to change an object's "look at" description after it's been burned, you would do:

teddybear.look = "A badly burned mass of fur that could once have been a teddy bear."

Objects' "look at" descriptions are stored in the look attribute. The verbs that display when they are clicked on are in a stringlist attribute called displayverbs (or inventoryverbs when the object is held). A room's description is the description attribute, and the name that appears for an object is the alias attribute.

Creating verbs isn't so easy; but that's rarely a good idea anyway. Instead, set an attribute to store what state the object is in. Within the verb's script, check the value of that attribute, and use that to either do the verb or display a message telling the player why they can't. You can also remove the verb from displayverbs or from generatedverbslist to stop it from displaying; but it's a good idea to also have the verb check, just in case the player types it anyway.

You can change what a verb does by setting an attribute with the same name as the verb (it can either be a scriptdictionary, a script, or a string). But adding or removing a verb by this method won't change the menus or verb buttons that are displayed.

Hope that covers everything.


Unfortunately I only know how to use the non-code version of Quest, so much interpretation must be done.


@mrangel This actually ended up creating more questions than answers ;(


Log in to post a reply.

Support

Forums