Question about descriptions

comradepants
Is it possible to display exits, objects, etc. AFTER a room description appears?

guzmere
Hi have a look in the forum at --------Room descriptions/Object descriptions---------
Best of luck nuff said :D :D :D :D

sgreig
It is possible. It's been done in Tim Hamilton's Things That Go Bump In The Night, and I also do it in my game Sleuth. Since this is pretty complicated (I needed Alex's help with this), I'll post the code here but there are a few steps you need to do first: (make sure to backup your game file first unless you're confident you know what you're doing. Better safe than sorry.)

1: You need to click the filters button at the bottom of the node tree on the left, and click on show library elements. Then, you have to find the ShowRoomDescription function in the list. If you click on that, you'll see a yellow bar appear across the top of the editor window with a copy button. Click that and it will import the function into your game so you can modify it.

2: At this point, you'll want to switch over to the code view (button is second from the right at the top of the window) and scroll down until you see the part that says:

<function name="ShowRoomDescription">

You can then replace that code with my code here:


<function name="ShowRoomDescription"><![CDATA[
if (HasScript(player.parent, "description")) {
do (player.parent, "description")
}
else {
if (game.autodescription) {
youarein = player.parent.descprefix
msg (youarein + " " + GetDisplayName(player.parent) + ".")
fulldesc = ""
if (HasString(player.parent, "description")) {
if (LengthOf(player.parent.description) > 0) {
fulldesc = player.parent.description
}
}
if (game.appendobjectdescription) {
foreach (val, ScopeVisibleNotHeld()) {
if (HasString(val, "description")) {
if (LengthOf(val.description) > 0 and val <> player) {
fulldesc = fulldesc + " " + val.description
}
}
}
}
if (LengthOf(fulldesc) > 0) {
msg (fulldesc)
}
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) {
msg (fulldesc)
}
}
}
]]></function>


If you did everything correctly, when you run your game the exits and objects should now display after the room description.

comradepants
Wow, thanks a lot! I shall give it a shot :D

EDIT: Works just fine. Thanks for your help!

sgreig
No problem. Glad I could help! I would remiss if I didn't thank Alex for giving me the code that worked. :)

demonboy
Could someone tell me if this is still relevant or if this has been addressed in 5.3?

HegemonKhan
yes, see here in the GUI for yourself:

Objects -> Game -> (1) Setup, (2) Script, (3) Room Descriptions, (4) Player, (5) Display, (6) Attributes

so click on the Room Descriptions:

Game -> Room Descriptions

check box for "Automatically generate room descriptions"

check box for "Show room description when entering a room"

check box for "Append in-room descriptions to room descriptions"

as can be seen very noobie-friendly with the GUI, wink

demonboy
But when using scripts those options do not put the description before the objects and exits, which is what the OP wanted (and what I'm after too).

Pertex
Can't you change the room description layout in the room descriptions tab in game?
sshot-2.png

sonic102
Yes, someone gave the actual answer to this question!

demonboy
No, this does still not solve my problem. I have Pertex's screenshot set up so the description is second, but in my first room under the scripts tab, under 'After entering the room for the first time', I am printing a message which is the initial room description and this is still displaying last. Perhaps there should be a fifth option in that Room Description Layout order to place your scripts?

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

Support

Forums