Room Description/Objects descriptions
timetolose
17 Dec 2011, 22:58Hi,
I would like to have *first* the full room description and *after* the list of objects in scope and the exits!
I tried to change game oprions, but I wasn't able to obtain the result.
Now I have something like this:
You are in a The Cyclops Cave.
You can see cheeses and a flock.
You can go east.
"The Cyclops cave is very nice and etc. etc. "
Please help.
Another issue. If I leave blank the Room Description prefix, it appears a space before the name of the room in the description, and I don't like it. There is a way to avoid this?:
"[space] The Cyclops Cave".
I would like to have *first* the full room description and *after* the list of objects in scope and the exits!
I tried to change game oprions, but I wasn't able to obtain the result.
Now I have something like this:
You are in a The Cyclops Cave.
You can see cheeses and a flock.
You can go east.
"The Cyclops cave is very nice and etc. etc. "
Please help.
Another issue. If I leave blank the Room Description prefix, it appears a space before the name of the room in the description, and I don't like it. There is a way to avoid this?:
"[space] The Cyclops Cave".
timetolose
19 Dec 2011, 00:05I think I solved this issues.
Please let me know if I'm right.
1) to have objects and exits lists *after* the description of the room, I changed the file named "CoreDescriptions.aslx" (I also erased the space and put a paragraph after objects description appended). I'm posting the file at the end of this message.
2) to avoid the space before the Room Name, I think you have to change te "youarein" text.
Please tell me if I'm wrong or if my changes affected something else creating a new problem!
CoreDescription.asxl
Please let me know if I'm right.
1) to have objects and exits lists *after* the description of the room, I changed the file named "CoreDescriptions.aslx" (I also erased the space and put a paragraph after objects description appended). I'm posting the file at the end of this message.
2) to avoid the space before the Room Name, I think you have to change te "youarein" text.
Please tell me if I'm wrong or if my changes affected something else creating a new problem!
CoreDescription.asxl
<library>
<function name="ShowRoomDescription">
<![CDATA[
if (HasScript(player.parent, "description")) {
do (player.parent, "description")
}
else {
fulldesc = ""
youarein = player.parent.descprefix
msg (youarein + " " + GetDisplayName(player.parent) + ".")
if (HasString(player.parent, "description")) {
if (LengthOf(player.parent.description) > 0) {
fulldesc = player.parent.description
msg (fulldesc)
}
}
}
if (game.autodescription) {
desc = FormatObjectList(player.parent.objectslistprefix, GetNonTransparentParent(player.parent), Template("And"), ".", false)
exits = FormatExitList(player.parent.exitslistprefix, ScopeExits(), Template("Or"), ".")
fulldesc = ""
if (LengthOf(desc) > 0) {
fulldesc = desc
if (LengthOf(exits) > 0) {
fulldesc = fulldesc + "<br />"
}
}
if (LengthOf(exits) > 0) {
fulldesc = fulldesc + exits
}
if (LengthOf(fulldesc) > 0) {
}
if (game.appendobjectdescription) {
foreach (val, ScopeVisibleNotHeld()) {
if (HasString(val, "description")) {
if (LengthOf(val.description) > 0 and val <> player) {
fulldesc = fulldesc + "<br />" + val.description
}
}
}
}
if (LengthOf(fulldesc) > 0) {
msg (fulldesc)
}
}
]]>
</function>
<function name="OnEnterRoom">
game.displayroomdescriptiononstart = false
if ((not GetBoolean(player.parent, "visited")) and HasScript(player.parent, "beforefirstenter")) {
do (player.parent, "beforefirstenter")
}
request (UpdateLocation, CapFirst(GetDisplayName(player.parent)))
if (game.useframe) {
roomFrameExists = false
if (HasString(player.parent, "picture")) {
if (LengthOf(player.parent.picture) > 0) {
roomFrameExists = true
SetFramePicture(player.parent.picture)
}
}
if (game.clearframe and not roomFrameExists) {
ClearFramePicture
}
}
if (game.showdescriptiononenter) {
ShowRoomDescription
}
if ((not GetBoolean(player.parent, "visited")) and HasScript(player.parent, "firstenter")) {
do (player.parent, "firstenter")
}
set (player.parent, "visited", true)
if (HasScript(player.parent, "enter")) {
do (player.parent, "enter")
}
</function>
<function name="FormatObjectList" type="string" parameters="preList, parent, preFinal, postList, useinventoryverbs">
<![CDATA[
result = ""
count = 0
list = RemoveSceneryObjects(GetDirectChildren(parent))
listLength = ListCount(list)
foreach (item, list) {
if (LengthOf(result) = 0) result = preList + " "
if (useinventoryverbs) {
verbs = item.inventoryverbs
}
else {
verbs = item.displayverbs
}
result = result + GetDisplayNameLink(item, "object", verbs)
if (CanSeeThrough(item)) {
result = result + FormatObjectList(" (" + item.contentsprefix, item, preFinal, ")", useinventoryverbs)
}
count = count + 1
if (count = listLength - 1) {
result = result + " " + preFinal + " "
}
else if (count < listLength) {
result = result + ", "
}
else {
result = result + postList
}
}
return (result)
]]>
</function>
<function name="GetDirectChildren" type="objectlist" parameters="parent">
<![CDATA[
result = NewObjectList()
foreach (obj, AllObjects()) {
if (obj.parent = parent and obj <> player) {
list add (result, obj)
}
}
return (result)
]]>
</function>
<function name="RemoveSceneryObjects" type="objectlist" parameters="list">
result = NewObjectList()
foreach (obj, list) {
if (not obj.scenery) {
list add (result, obj)
}
}
return (result)
</function>
<function name="FormatExitList" type="string" parameters="preList, list, preFinal, postList">
<![CDATA[
result = ""
count = 0
listLength = ListCount(list)
foreach (item, list) {
if (LengthOf(result) = 0) result = preList + " "
result = result + GetDisplayNameLink(item, "exit", item.displayverbs)
count = count + 1
if (count = listLength - 1) {
result = result + " " + preFinal + " "
}
else if (count < listLength) {
result = result + ", "
}
else {
result = result + postList
}
}
return (result)
]]>
</function>
<function name="GetDisplayAlias" type="string" parameters="obj">
<![CDATA[
if (HasString(obj, "alias")) {
result = obj.alias
}
else {
result = obj.name
}
return (result)
]]>
</function>
<function name="GetDisplayName" type="string" parameters="obj">
return (GetDisplayNameLink(obj, "", null))
</function>
<function name="GetDisplayNameLink" type="string" parameters="obj, type, verbs">
<![CDATA[
result = GetTaggedName(obj, type, verbs)
if (not GetBoolean(obj, "usedefaultprefix")) {
if (obj.prefix = null) {
prefix = ""
}
else {
prefix = obj.prefix
}
}
else if (type = "exit") {
prefix = ""
}
else {
prefix = GetDefaultPrefix(obj)
}
if (LengthOf(prefix)>0) prefix = prefix + " "
result = prefix + result
if (not GetBoolean(obj, "usedefaultprefix") and HasString(obj, "suffix")) {
result = result + " " + obj.suffix
}
return (result)
]]>
</function>
<function name="GetTaggedName" type="string" parameters="obj, type, verbs">
<![CDATA[
alias = GetDisplayAlias(obj)
if (not game.enablehyperlinks) {
type = ""
}
if (not type = "") {
result = "<object"
if (verbs <> null) {
result = result + " verbs='" + Join(verbs, "/") + "'"
}
result = result + ">" + alias + "</object>"
}
else {
result = alias
}
return (result)
]]>
</function>
</library>
Alex
19 Dec 2011, 11:36Looks good to me. I'd like to expand the game options at some point to make it easier to customise the descriptions, but for now editing the ShowRoomDescription function is the right way to go.
I would make sure that you only edit that function for that particular game though, otherwise it will apply to all games you make on your machine. In the Editor, at the bottom of the tree on the left, you can click "Filter" then "Show Library Elements". Then you can select the ShowRoomDescription function and make a local copy just in your game's .aslx file, which you can edit as you wish.
I would make sure that you only edit that function for that particular game though, otherwise it will apply to all games you make on your machine. In the Editor, at the bottom of the tree on the left, you can click "Filter" then "Show Library Elements". Then you can select the ShowRoomDescription function and make a local copy just in your game's .aslx file, which you can edit as you wish.
timetolose
19 Dec 2011, 11:44Thanks Alex.
Maybe at the end of the routine "if (game.autodescription)" there is a line in excess: if (LengthOf(fulldesc) > 0) { }
Should I remove that?
Maybe at the end of the routine "if (game.autodescription)" there is a line in excess: if (LengthOf(fulldesc) > 0) { }
Should I remove that?
Alex
19 Dec 2011, 12:02That's not empty in the original version, it has this between the braces:
msg (fulldesc)
timetolose
19 Dec 2011, 12:13Yes, it is not empty, but I moved that line "msg (fulldesc)", so it remained empty: it is useless and it is better to remove it now, in my new versione of the code?
Alex
19 Dec 2011, 12:38Yes if you've removed the msg line, you can safely remove the entire "if" block as it won't be doing anything useful.
Dazakiwi32
28 Mar 2012, 07:58This still seems to be a problem in the latest version 5.1.1.
I want the room description first then list what objects are in the room etc..
I see an option to select or unselect Append Object descriptions to Room descriptions, but whether its selected or not doesn't seem to make a difference.
I want the room description first then list what objects are in the room etc..
I see an option to select or unselect Append Object descriptions to Room descriptions, but whether its selected or not doesn't seem to make a difference.
Alex
28 Mar 2012, 08:07Quest 5.2 has a new feature that lets you reorder the generated room descriptions. This will be in beta in a week or two.
Creativita
28 Mar 2012, 09:02Is it possible to remove the list of objects within a room all together? I often want to briefly describe the objects and their placement within the room. I have tried to change each object to scenery but then they don't appear in your inventory.
Alex
28 Mar 2012, 10:54Yes, the room description customisation lets you completely remove lines from the description if you want.
Creativita
28 Mar 2012, 11:12Thank you again. Also, is there a way in which to mention two or more objects within an if script? I am creating a script which will display a different room description if an object is removed or placed in the room. I'm sorry if I'm pestering you with these probably obvious questions.

Pertex
28 Mar 2012, 11:41Do you know the gameoption "Append room object descriptions to room description"? With this the description of an object is displayed after the room description, so you don't have to change the room description by script
Alex
28 Mar 2012, 16:09You mean check if two objects are in the room at the same time?
You could change the "if" to "expression", and then use an "and". So, let's say you currently have:
If: [object is visible] [object] [something]
You can change the [object is visible] dropdown to [expression], and you'll see the underlying expression:
If: [expression] ListContains(ScopeVisible(), something)
You can update this to
If: [expression] ListContains(ScopeVisible(), something) and ListContains(ScopeVisible(), something else)
Alternatively, you can simply add a new "if" inside the "Then" script of your existing "if".
You could change the "if" to "expression", and then use an "and". So, let's say you currently have:
If: [object is visible] [object] [something]
You can change the [object is visible] dropdown to [expression], and you'll see the underlying expression:
If: [expression] ListContains(ScopeVisible(), something)
You can update this to
If: [expression] ListContains(ScopeVisible(), something) and ListContains(ScopeVisible(), something else)
Alternatively, you can simply add a new "if" inside the "Then" script of your existing "if".
sgreig
28 Mar 2012, 21:33I also posted code for a modified ShowRoomDescription function that puts the room description first in another thread on this forum, so you can copy and paste that in the meantime if you'd like.
Pertex> I've tried using that option before, but it didn't seem to do anything.
Pertex> I've tried using that option before, but it didn't seem to do anything.
Creativita
28 Mar 2012, 22:02Thankyou. I'll make sure to do that.

Pertex
29 Mar 2012, 06:36@sgreig: this must work! because I implemented it
It appends the "Room object description" (not the "Look at object description") to the room description.

sgreig
29 Mar 2012, 22:07@Pertex> I think the reason it doesn't work for me is because the items in my game have scripts for their descriptions instead of just plain text. 
