[SOLVED] Room Description Scripts and inroomdescription problem
K.V.
11 May 2021, 00:57Yeah, I'm messing stuff up! What up? That's how I roll! That's how I learn! Nawmean!?!?
Now, I admittedly have numerous modified functions in this project, so it may be some of my code in some other part of the game messing with me. So, I'll ask this way:
Is there something that causes Quest to bypass the inroomdescription
stuff when the room has a description
script rather than a string?
Or have I messed something else up somewhere?
K.V.
11 May 2021, 01:57I got it working (after much head-scratching).
I don't know if it was my modified code or not. If not, I'll be back with the information.
K.V.
11 May 2021, 02:08This works as expected. It doesn't say "You can see..." because the only object in the room is the doohickey, and it is scenery.
It also prints "There is a strange doohickey here.", as expected.
<!--Saved by Quest 5.8.7753.35184-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="inroomdescription_vs_description_script">
<gameid>2c52fb76-321c-4604-9472-cc63b832f071</gameid>
<version>1.0</version>
<firstpublished>2021</firstpublished>
<appendobjectdescription />
</game>
<object name="room">
<inherit name="editor_room" />
<isroom />
<description>The room has a BS description.</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="doohickey">
<inherit name="editor_object" />
<take />
<inroomdescription><![CDATA[{if doohickey.scenery:<br/>There is a strange doohickey here.}]]></inroomdescription>
<scenery />
</object>
</object>
</asl>
BUT
If I change the room description
to a script, it no longer prints the doohickey's inroomdescription
.
<!--Saved by Quest 5.8.7753.35184-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="inroomdescription_vs_description_script">
<gameid>2c52fb76-321c-4604-9472-cc63b832f071</gameid>
<version>1.0</version>
<firstpublished>2021</firstpublished>
<appendobjectdescription />
</game>
<object name="room">
<inherit name="editor_room" />
<isroom />
<description type="script">
msg ("This description sucks, and it is printed via description script.")
</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="doohickey">
<inherit name="editor_object" />
<take />
<inroomdescription><![CDATA[{if doohickey.scenery:<br/>There is a strange doohickey here.}]]></inroomdescription>
<scenery />
</object>
</object>
</asl>
K.V.
11 May 2021, 02:15The Fix
Now, I don't know if everyone expects the in room descriptions on objects to print whether or not the room description is a string or a script attribute, but I expect them to print either way.
So, I modified ShowRoomDescription
in two places, which I have comments above in this code:
<!--Saved by Quest 5.8.7753.35184-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="inroomdescription_vs_description_script">
<gameid>2c52fb76-321c-4604-9472-cc63b832f071</gameid>
<version>1.0</version>
<firstpublished>2021</firstpublished>
<appendobjectdescription />
</game>
<object name="room">
<inherit name="editor_room" />
<isroom />
<description type="script">
OutputTextNoBr ("This description sucks, and it is printed via description script.")
</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="doohickey">
<inherit name="editor_object" />
<take />
<inroomdescription><![CDATA[{if doohickey.scenery:<br/>There is a strange doohickey here.}]]></inroomdescription>
<scenery />
</object>
</object>
<function name="ShowRoomDescription"><![CDATA[
isDark = CheckDarkness()
if (isDark) {
descriptionfield = "darkroomdescription"
}
else {
descriptionfield = "description"
}
if (game.autodescription) {
desc = ""
for (i, 1, 4) {
if (i = game.autodescription_youarein) {
if (game.autodescription_youarein_useprefix) {
youarein = game.pov.parent.descprefix
desc = AddDescriptionLine (desc, youarein + " " + GetDisplayName(game.pov.parent) + ".")
}
else {
desc = AddDescriptionLine (desc, "<b>" + CapFirst(GetDisplayName(game.pov.parent)) + "</b>")
}
if (game.autodescription_youarein_newline) {
msg (desc + "<br/>")
desc = ""
}
}
if (i = game.autodescription_youcansee) {
objects = FormatObjectList(game.pov.parent.objectslistprefix, GetNonTransparentParent(game.pov.parent), Template("And"), ".")
desc = AddDescriptionLine(desc, objects)
if (game.autodescription_youcansee_newline) {
msg (desc + "<br/>")
desc = ""
}
}
if (i = game.autodescription_youcango) {
exits = FormatExitList(game.pov.parent.exitslistprefix, GetExitsList(), Template("Or"), ".")
desc = AddDescriptionLine(desc, exits)
if (game.autodescription_youcango_newline) {
msg (desc + "<br/>")
desc = ""
}
}
if (i = game.autodescription_description) {
if (HasScript(game.pov.parent, descriptionfield)) {
if (LengthOf(desc) > 0) {
msg (desc)
desc = ""
}
do (game.pov.parent, descriptionfield)
// NEXT LINE ADDED BY KV 2021.05.10
msg (GetRoomDescription())
if (game.autodescription_description_newline) {
msg ("")
}
}
else {
desc = AddDescriptionLine(desc, GetRoomDescription())
if (game.autodescription_description_newline) {
msg (desc + "<br/>")
desc = ""
}
}
}
}
if (LengthOf(desc) > 0) {
msg (desc)
}
}
else {
if (HasScript(game.pov.parent, descriptionfield)) {
do (game.pov.parent, descriptionfield)
// NEXT LINE ADDED BY KV 2021.05.10
msg (GetRoomDescription())
}
else {
fulldesc = GetRoomDescription()
if (LengthOf(fulldesc) > 0) {
msg (fulldesc)
}
}
}
]]></function>
</asl>