Changing in-room descriptions

I'd like to make it so I can manually create in-room descriptions for each object. Also, I'd like to be able to CHANGE the in-room description when the object has been used, or looked at, etc. This way when the player look at the room, the object's in-room description is updated based on what has happened to the object.

I can't seem to find any built in way to change the in room description after specific actions...could someone more experienced help me with this? Thanks.


I think I know what you are asking... but...
Give an example:
IE: player first walks into the room and sees... (the room description, with a TV that is currently turned off)
(I'm guessing there is a TV and the player turned it on)
Now, if the player Looks, or reenters the room... (the room description, with a TV playing an old western)

If that is the case, in the description of the TV, there would be an "off state" and an "on state" and the room description would reflect that...
I think the tutorial covers this...


This has been discussed quite a bit in the past. Too bad we cannot link old forum posts... possibly in the future?

Anyway...

I believe there were options that suited the last inquiry about this using text processor commands. See here. http://docs.textadventures.co.uk/quest/text_processor.html I'd help further but am not familiar with text processor commands too much.

In my games, I only have couple things that could possibly change per room. As a 'simple' example, I used If scripts in the room description to give more accurate descriptions. An example from X3 would be a room in which there is a barrel. If the player progresses far enough in the game, they may have used proper fuel sources to ignite the barrel. At this point, I added a 'fire' object to the room and used an If script to check if the fire is visible. If so, I printed a message like "You are in a barren field. In the middle of the field is a metal barrel that is currently containing a very active (and hot) fire. Else, print message "You are in a barren field. In the middle of the field is a metal barrel that currently contains some dry ash."

I also have much more complicated scenarios in X3. I used an object attribute equals script to check for the current time of day. If object twentyfourhours has attribute equal to midnight, then I would print a message that there are no vendors currently set up in the market. If attribute equals noon, I printed a message indicating that there are six merchants available to interact with. If you are interested in viewing the more complicated version, let me know and I will help.

There are multiple ways to do this. I have yet to find an easy way to do it, but I highly encourage game creators to take the time to change/alter room descriptions as certain events have unfolded. It makes for so much better of a game.


1A. Use the text processor commands (more friendly for non-coders, but more limited): http://docs.textadventures.co.uk/quest/text_processor.html

1B. change the 'room description (description)' Attribute from a String Attribute to a Script Attribute, which then allows for you to use Attributes and the 'if' Script, and your separate actions/events (Verbs, Commands, Functions, Turnscripts, Timers, etc) would set/re-set/alter/change/etc your indicators/flags (Attributes).

for example (in code):

'this' is a special key-word/key-command that gets the (reference of the) parent Object (ie: my 'example_room' Object) of the scripting. You can replace 'this' with (for this example) 'example_room', if you prefer not using 'this'.

<object name="example_room">
  <inherit name="editor_room" />
  <attr name="alias" type="string">unknown</attr>
  <attr name="state" type="int">0</attr>
  <attr name="description" type="script">
    if (this.state = 0) {
      this.alias = "forest"
    } else if (this.state = 1) {
      this.alias = "jungle"
    } else if (this.state = 2) {
      this.alias = "swamp"
    } else if (this.state = 3) {
      this.alias = "desert"
    } else if (this.state = 4) {
      this.alias = "tundra"
    }
    msg ("You are in a " + this.alias + ".")
    if (this.state = 4) {
      this.state = 0
    } else {
      this.state = this.state + 1
    }
  </attr>
</object>

see this link on using Attributes and the 'if' Script:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

here's a step by step guide on creating your own demo game for learning the basics of Attribute usage:

http://textadventures.co.uk/forum/quest/topic/5387/i-really-need-help

ask if you need help with anything


If you want to change the inroom-description just set this attribute:

objectname.inroomdescription = "Enter a new description here"

"1B. change the 'room description (description)' Attribute from a String Attribute to a Script Attribute, which then allows for you to use Attributes and the 'if' Script, and your separate actions/events (Verbs, Commands, Functions, Turnscripts, Timers, etc) would set/re-set/alter/change/etc your indicators/flags (Attributes)."

You can use If in the text processor also.

{if object.attribute:text}
Display text only if object attribute is true.

{if not object.attribute:text}
Display text only if object attribute is false.


1B. change the 'room description (description)' Attribute from a String Attribute to a Script Attribute, which then allows for you to use Attributes and the 'if' Script, and your separate actions/events (Verbs, Commands, Functions, Turnscripts, Timers, etc) would set/re-set/alter/change/etc your indicators/flags (Attributes).

If you create your own room description by script, inroomdescriptions do not work any more


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums