Room Descriptions

I am trying to make a command so when you type it in it will repeat the room description. How can I make it? Also the things that I write to the in-room descriptions are not showing up. What is the reason? Thank you.


I am trying to make a command so when you type it in it will repeat the room description. How can I make it?

You mean the same as the built-in "look" command?

The command's script should invoke one function:

ShowRoomDescription

That's all you need.

Also the things that I write to the in-room descriptions are not showing up.

To solve that problem, we'd probably need to take a look at the game.


Should I post the whole code of the game? Also the first one worked, thank you.


Should I post the whole code of the game? Also the first one worked, thank you.

I think most people upload their games on this site and provide a link (you can publish a game and make it only accessible to people who have the link), but posting the whole code would be a reasonable compromise.

You could put it between <details> and </details> so people can click to display it and it doesn't make the thread hard to navigate (although you may need to put a line in between the <details> and the first ``` to stop the forum mangling the code).


This is the entire code of game. I couldn't make it in details so please pardon me

<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <include ref="CombatLib.aslx" />
  <include ref="ConvLib.aslx" />
  <include ref="QuestLib.aslx" />
  <include ref="ShopLib.aslx" />
  <include ref="StackLib.aslx" />
  <game name="Terebrisia">
    <gameid>9825a9ed-83dc-4bb7-bdac-6791a95cb0a8</gameid>
    <version>1.0</version>
    <firstpublished>2021</firstpublished>
    <showhealth />
    <showmoney />
    <feature_lightdark />
    <attr name="feature_asktell" type="boolean">false</attr>
    <appendobjectdescription />
    <setbackgroundopacity type="boolean">false</setbackgroundopacity>
    <deactivatecommandlinks type="boolean">false</deactivatecommandlinks>
    <underlinehyperlinks type="boolean">false</underlinehyperlinks>
    <defaultforeground>White</defaultforeground>
    <defaultbackground>Black</defaultbackground>
    <defaultlinkforeground>Gold</defaultlinkforeground>
    <menubackground>Black</menubackground>
    <menuforeground>Gold</menuforeground>
    <panestheme>Black</panestheme>
    <moneyformat>! Gold</moneyformat>
    <defaultfont>'Palatino Linotype', 'Book Antiqua', Palatino, serif</defaultfont>
    <enablehyperlinks type="boolean">false</enablehyperlinks>
    <clearscreenonroomenter type="boolean">false</clearscreenonroomenter>
    <attr name="autodescription_youarein_useprefix" type="boolean">false</attr>
    <feature_advancedwearables />
    <turnoffplacesandobjects type="boolean">false</turnoffplacesandobjects>
    <attr name="feature_limitinventory" type="boolean">false</attr>
    <attr name="feature_advancedscripts" type="boolean">false</attr>
    <attr name="autodescription_youarein" type="int">0</attr>
    <attr name="autodescription_youcansee" type="int">0</attr>
    <attr name="autodescription_youcango" type="int">0</attr>
    <attr name="autodescription_description" type="int">1</attr>
    <attr name="autodescription_youarein_newline" type="boolean">false</attr>
    <autodescription />
    <showdescriptiononenter />
    <start type="script">
      CombatInitialise
      WearGarment (underpants)
      AddToInventory (Keychain)
    </start>
    <onhealthzero type="script">
    </onhealthzero>
  </game>
  <object name="Bedroom">
    <inherit name="editor_room" />
    <description>This is your white painted small bedroom. There is a drawer right next to your bed, and there is a wardrobe across the bed. There is your study desk and your bookshelf in the west wall. Also the door of the room is going to your living room. Some struggle sounds coming from the other side of the door.</description>
    <dropdestination type="object">Bedroom</dropdestination>
    <beforefirstenter type="script">
      msg ("You wake up with the sounds coming from the other parts of the home. You slowly stand up in your bed, take the blanket on you and throw it to the other side of the bed. You shiver as your bare feet touch the cold stone floor.")
    </beforefirstenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
      <scream>Aaaaaarrrrrrgggghhhhh!!!</scream>
      <fly>Realy?</fly>
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Take</value>
      </displayverbs>
      <attr name="pov_look" type="script">
        msg ("You are wearing " + ListClothes () + ".")
      </attr>
      <commitsuicide type="script">
        msg ("Are you sure? Yes or No")
        get input {
          if (Yes) {
            DecreaseHealth (100)
            msg ("...")
          }
          else if (No) {
            msg ("Okay, maybe another time")
          }
        }
      </commitsuicide>
    </object>
    <object name="Drawer">
      <inherit name="editor_object" />
      <inherit name="container_closed" />
      <feature_container />
      <hidechildren type="boolean">false</hidechildren>
      <listchildren />
      <look>It is your old but reliable drawer. You made it from wood in the old days...</look>
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Open</value>
        <value>Close</value>
      </displayverbs>
      <usedefaultprefix />
      <listchildrenprefix>In it there is</listchildrenprefix>
      <transparent type="boolean">false</transparent>
      <isopen type="boolean">false</isopen>
      <object name="Key of the Bedroom">
        <inherit name="editor_object" />
        <inherit name="childstack_object" />
        <look>It is the old key of your bedroom.</look>
        <take type="boolean">false</take>
        <usedefaultprefix type="boolean">false</usedefaultprefix>
        <stackparent type="object">Keychain</stackparent>
        <ontake type="script">
        </ontake>
      </object>
      <object name="Handful of Gold">
        <inherit name="editor_object" />
        <inherit name="cash_object" />
        <inherit name="plural" />
        <look>There are 23 gold. This golds are your little treasure that you make with your own sweat.</look>
        <money type="int">23</money>
        <usedefaultprefix type="boolean">false</usedefaultprefix>
      </object>
    </object>
    <object name="Bookshelf">
      <inherit name="editor_object" />
      <look>It is your old bookshelf and it is pretty dusty because you don't have enough time for reading books because you are making very important things... Okay, you just hate books, this is the reason...</look>
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
    </object>
    <object name="Wardrobe">
      <inherit name="editor_object" />
      <inherit name="container_closed" />
      <look>This is your small wood wardrobe.</look>
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
      <feature_container />
      <isopen type="boolean">false</isopen>
      <hidechildren />
      <listchildren />
      <listchildrenprefix>In it there is</listchildrenprefix>
      <object name="shirt">
        <inherit name="editor_object" />
        <inherit name="wearable" />
        <inherit name="merchandise" />
        <inventoryverbs type="stringlist">
          <value>Look at</value>
          <value>Drop</value>
        </inventoryverbs>
        <look>It is your old, grey shirt, but it is pretty comfortable</look>
        <feature_wearable />
        <attr name="wear_layer" type="int">3</attr>
        <wear_slots type="stringlist">
          <value>Torso</value>
        </wear_slots>
        <price type="int">5</price>
        <removeable />
        <multistate type="boolean">false</multistate>
        <armour type="int">1</armour>
      </object>
      <object name="pants">
        <inherit name="editor_object" />
        <inherit name="wearable" />
        <inherit name="merchandise" />
        <inherit name="plural" />
        <look>These are your old, grey pants, but they are pretty comfortable</look>
        <inventoryverbs type="stringlist">
          <value>Look at</value>
          <value>Drop</value>
        </inventoryverbs>
        <feature_wearable />
        <wear_slots type="stringlist">
          <value>Legs</value>
        </wear_slots>
        <price type="int">5</price>
        <removeable />
        <usedefaultprefix type="boolean">false</usedefaultprefix>
        <armour type="int">1</armour>
      </object>
    </object>
    <object name="Study Desk">
      <inherit name="editor_object" />
      <inherit name="surface" />
      <feature_container />
      <listchildren />
      <listchildrenprefix>On which there is</listchildrenprefix>
      <look>It is your old study desk from wood.</look>
      <object name="Candy">
        <inherit name="editor_object" />
        <inherit name="edible" />
        <look>It is lemony, you hate it!</look>
        <take />
        <feature_edible />
        <eathealth type="int">0</eathealth>
        <eatmsg>Eyyww! It is lemony...</eatmsg>
      </object>
    </object>
    <exit name="Exit to Living Room" alias="east" to="Living Room">
      <inherit name="eastdirection" />
      <locked type="boolean">false</locked>
      <runscript />
      <script type="script">
        if (Got(Key of the Bedroom)) {
          msg ("You open the door with the key!")
          MoveObject (player, Living Room)
        }
        else {
          msg ("It is locked.")
        }
      </script>
    </exit>
    <object name="Divan Bed">
      <inherit name="editor_object" />
      <look>This is your divan bed.</look>
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
    </object>
  </object>
  <object name="Starter Clothes">
    <inherit name="editor_room" />
    <object name="underpants">
      <inherit name="editor_object" />
      <inherit name="wearable" />
      <inherit name="plural" />
      <feature_wearable />
      <attr name="wear_layer" type="int">1</attr>
      <removeable type="boolean">false</removeable>
      <removemsg>Oh, come on!</removemsg>
      <look type="string"></look>
      <inventoryverbs type="stringlist" />
      <price type="int">0</price>
      <wear_slots type="stringlist">
        <value>Legs</value>
      </wear_slots>
      <usedefaultprefix type="boolean">false</usedefaultprefix>
    </object>
  </object>
  <command>
    <pattern>scream;shout</pattern>
    <script>
      msg ("Aaaaaarrrrrrgggghhhhh!!!")
    </script>
  </command>
  <command>
    <pattern>fly</pattern>
    <script>
      msg ("Really?")
    </script>
  </command>
  <object name="Living Room">
    <inherit name="editor_room" />
    <dropdestination type="object">Living Room</dropdestination>
    <description type="script"><![CDATA[
      if (Slightly İnjured Goblin.hitpoints < 1) {
        if (Goblin.hitpoints < 1) {
          msg ("This is your's house living room. It is not pretty small but it is not pretty big either. There is a big mess in the room. You have your currently broken table next to your sofa lying on its side on the floor. Your father's bookshelf is overturned and all the books in it are scattered around. There is a small puddle of blood on the floor that is slowly spreading throughout the room.")
        }
        else {
          msg ("You fight with everything that you have")
        }
      }
      else {
        msg ("You fight with everything that you have")
      }
    ]]></description>
    <beforefirstenter type="script">
      msg ("As soon as you enter the room, you come eye to eye with a green, ugly creature. It yells to the other creature on the other side of the room. They are goblins! The first goblin that you see has a rusty dagger in it's hand. The other one has a injury on it's right arm. While you think, the goblins leaps on you...")
    </beforefirstenter>
    <exit alias="west" to="Bedroom">
      <inherit name="westdirection" />
    </exit>
    <object name="Goblin">
      <inherit name="editor_object" />
      <inherit name="monster" />
      <look>This is a green ugly creature. It has old clothes on it and it looks very sneaky.</look>
      <displayverbs type="stringlist">
        <value>Look at</value>
        <value>Attack</value>
      </displayverbs>
      <level type="int">1</level>
      <hitpoints type="int">5</hitpoints>
      <attackasgroup />
      <attackonsight />
      <monstertype>Goblinoid</monstertype>
      <damagedicesides type="int">5</damagedicesides>
      <damagebonus type="int">0</damagebonus>
      <nonweapon type="boolean">false</nonweapon>
      <attackdesc>% swings its rusty little dagger on you</attackdesc>
      <damagedicenumber type="int">1</damagedicenumber>
      <attackbonus type="int">1</attackbonus>
      <movetype>Free</movetype>
      <noncorporeal type="boolean">false</noncorporeal>
      <doesnotattack type="boolean">false</doesnotattack>
      <object name="Rusty Little Dagger">
        <inherit name="editor_object" />
        <inherit name="weapon" />
        <look>This is a rusty little dagger. It is very old and have been using by the goblins for years...</look>
        <level type="int">1</level>
        <canberusted type="boolean">false</canberusted>
        <damagedicesides type="int">5</damagedicesides>
        <damagedicenumber type="int">1</damagedicenumber>
        <price type="int">7</price>
        <attackbonus type="int">1</attackbonus>
      </object>
    </object>
    <object name="Slightly İnjured Goblin">
      <inherit name="editor_object" />
      <inherit name="monster" />
      <look>This is a green ugly creature. It has old clothes on it and it looks very sneaky. This goblin is slightly injured from its right arm.</look>
      <hitpoints type="int">4</hitpoints>
      <attackasgroup />
      <attackonsight />
      <monstertype>Goblinoid</monstertype>
      <nonweapon />
      <movetype>Free</movetype>
      <object name="Parchment">
        <inherit name="editor_object" />
        <take />
        <inventoryverbs type="stringlist">
          <value>Look at</value>
          <value>Drop</value>
        </inventoryverbs>
        <look type="script"><![CDATA[
          msg ("On the parchment it reads:<br/>\"Son,<br/>The goblins are right outside the door. They will break it in a few minutes. I don't know what they will do to me. I'll try to resist, but I presumably won't last long. Probably it will take some time for them to enter to your room. Take everything that you can take from home and go to the town leader. There is a defence against this creatures in town. Join them son, joi\" The text ends in here and there is a dropping of blood on the parhment...")
          QuestStart (it_is_enough, "Take everything that you can take and leave the home")
        ]]></look>
      </object>
    </object>
    <object name="Lockpick">
      <inherit name="editor_object" />
      <inherit name="merchandise" />
      <look>It is your lockpick, you have been a naughty boy since you were little.</look>
      <inroomdescription>And there is your lockpick in the ground.</inroomdescription>
      <take />
      <price type="int">5</price>
      <destroyonsale />
    </object>
    <object name="Small Puddle of Blood">
      <inherit name="editor_object" />
      <displayverbs type="stringlist">
        <value>Look at</value>
      </displayverbs>
      <look type="script">
        if (QuestState(it_is_enough) = "Active" ) {
          msg ("As you learned from your father, this is goblin blood. It must have spilled from that injured goblin as your father tried to resist.")
        }
        else {
          msg ("As you learned from your father, this is goblin blood.")
        }
      </look>
    </object>
    <exit alias="east" to="Kitchen">
      <inherit name="eastdirection" />
    </exit>
    <exit alias="north" to="Fathers Bedroom">
      <inherit name="northdirection" />
    </exit>
    <exit alias="out" to="Soil Road">
      <inherit name="outdirection" />
    </exit>
  </object>
  <object name="key room">
    <inherit name="editor_room" />
    <dark type="boolean">false</dark>
    <object name="Keychain">
      <inherit name="editor_object" />
      <inherit name="stack_container" />
      <alias>Keychain</alias>
      <inventoryverbs type="stringlist">
        <value>Look at</value>
      </inventoryverbs>
    </object>
  </object>
  <object name="quests">
    <inherit name="editor_room" />
    <object name="it_is_enough">
      <inherit name="editor_object" />
      <alias>It is enough!</alias>
    </object>
  </object>
  <command>
    <pattern>look around;look;l;look at room;look room</pattern>
    <script>
      ShowRoomDescription
    </script>
  </command>
  <object name="Kitchen">
    <inherit name="editor_room" />
    <dropdestination type="object">Kitchen</dropdestination>
    <description type="script">
      if (A bowl of rice.parent = Kitchen) {
        msg ("This is your house's little kitchen. There is a big mess in the room. One of the legs of the dining table, which was thrown into a corner of the room, was broken. The counter is in shambles and the faucet is broken. Chairs are everywhere of the room. There is nothing that you can save... Expect for that bowl of rice standing on the dining table strongly. The exit of the room is in the west...")
      }
      else {
        msg ("This is your house's little kitchen. There is a big mess in the room. One of the legs of the dining table, which was thrown into a corner of the room, was broken. The counter is in shambles and the faucet is broken. Chairs are everywhere of the room. There is nothing that you can save. The exit of the room is in the west...")
      }
    </description>
    <object name="A bowl of rice">
      <inherit name="editor_object" />
      <inherit name="edible" />
      <take />
      <look>A bowl of rice leftover from last night's meal. Looks delicious...</look>
      <feature_edible />
      <eatmsg>It is delicious!</eatmsg>
      <eathealth type="int">0</eathealth>
      <price type="int">5</price>
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Drop</value>
        <value>Eat</value>
      </inventoryverbs>
      <eat type="script">
        if (HasString(this, "eatmsg")) {
          msg (this.eatmsg)
        }
        else {
          msg (DynamicTemplate("Eaten", this))
        }
        if (HasInt(game.pov, "health")) {
          game.pov.health = game.pov.health + this.eathealth
        }
        destroy (this.name)
      </eat>
    </object>
    <exit alias="west" to="Living Room">
      <inherit name="westdirection" />
    </exit>
  </object>
  <object name="Fathers Bedroom">
    <inherit name="editor_room" />
    <description>Your father's bed and the drawer where he kept his valuables were broken. The mother's oil painting is gone, and everything in the closet has been taken. There's nothing left for you to save. The exit of the room is in south...</description>
    <dropdestination type="object">Fathers Bedroom</dropdestination>
    <exit alias="south" to="Living Room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="Soil Road">
    <inherit name="editor_room" />
    <description type="script">
      if (QuestState(it_is_enough) = "Active") {
        QuestNext (it_is_enough, "Find the town hall and enter it")
        msg ("This is one of your town's main roads. It goes both west and east. There is your house in the north and another house in the south (But I think you shouldn't enter there)")
      }
      else {
        msg ("This is one of your town's main roads. It goes both west and east. There is your house in the north and another house in the south (But I think you shouldn't enter there)")
      }
    </description>
    <dropdestination type="object">Soil Road</dropdestination>
    <beforefirstenter type="script">
      if (QuestState(it_is_enough) = "Active") {
        QuestNext (it_is_enough, "Find the town hall and enter it")
      }
    </beforefirstenter>
    <exit alias="in" to="Living Room">
      <inherit name="indirection" />
    </exit>
    <exit alias="east" to="Town Entry">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="Town Entry">
    <inherit name="editor_room" />
    <description>It is the only way out of your town because there is mountains in everywhere expect here. A road to the west will lead you into the town. There is a big door and a guardian protecting it in the east, the direction that will lead you out of the town...</description>
    <dropdestination type="object">Town Entry</dropdestination>
    <object name="Town Guardian">
      <inherit name="editor_object" />
      <inherit name="namedmale" />
      <inherit name="talkingchar" />
      <activeconversations />
      <exchange>Hello</exchange>
      <object name="open_door">
        <inherit name="editor_object" />
        <inherit name="startingtopic" />
        <hideafter type="boolean">false</hideafter>
        <alias>Can you open the door for me</alias>
        <talk type="script">
          if () {
          }
        </talk>
      </object>
    </object>
    <exit alias="west" to="Soil Road">
      <inherit name="westdirection" />
    </exit>
  </object>
</asl>

So the thing with the room description is done and you still have a problem with the inroom description? In your example there is only one inroomdescription and it is empty. Then nothing can be output there.


Please forgive me, after posting the issue here I started trying to fix it myself and got it done. But then when I realized this would work for a single room, I started waiting for an answer from here. However, I was a bit confused and accidentally forgot to remove that part. Please forgive me, I will take care of it immediately.


In room descriptions are appended to the end of the room's description string before printing it. It looks like they aren't used if description is a script.

You could get them back by adding:

msg (GetRoomDescription())

to the end of the description script.

I don't know why Quest doesn't do this automatically; I think it's something that might trip up a few people.


I didn't understand the place that I should put that code in


I think there is a LOT about Quest that trips people up.
Mainly, the requirement to nest getinput comands...
It's like talking to someone that doesn't know when to stop talking...
"So, how did you like the movie? Personally I thought it was great. Nice day isn't it? Yea, I like the colors of the sunset don't you?"
If Quest would stop at a GetInput and WAIT for the answer, then it would be better...
(Maybe a thought for Quest 6.0.)


I didn't understand the place that I should put that code in

If you have a room that runs a script for its description, add the line to the end of that script. For example, your Living Room description would become:

      if (Slightly İnjured Goblin.hitpoints < 1) {
        if (Goblin.hitpoints < 1) {
          msg ("This is your's house living room. It is not pretty small but it is not pretty big either. There is a big mess in the room. You have your currently broken table next to your sofa lying on its side on the floor. Your father's bookshelf is overturned and all the books in it are scattered around. There is a small puddle of blood on the floor that is slowly spreading throughout the room.")
        }
        else {
          msg ("You fight with everything that you have")
        }
      }
      else {
        msg ("You fight with everything that you have")
      }
      msg (GetRoomDescription())

Thank you so much, it finally worked.


Wow! Thank you, Rangel!

I was working on a little project and I decided would be better cleaning the screen every time the player checked on objects. In the end I had to create an object to write again the whole room description, every room. Now I may use a single object that moves with the player and reloads the room description!


Log in to post a reply.

Support

Forums