XanMag wrote:But... I'm confused... How do you handle it if they drop the keys in any other room?? That object would be printed as there anyway? Right?
// script examples:
check_and_return_dropped_object_to_original_location_function (silver_key)
check_and_return_dropped_object_to_original_location_function (gold_key)
check_and_return_dropped_object_to_original_location_function (skeleton_key)
// --------------------------------------
<function name="check_and_return_dropped_object_to_original_location_function" parameters="object_parameter">
if (not object_parameter.parent = game.pov) {
if (object_parameter.name = "silver_key") {
if (not object_parameter.parent = dungeon_room_5.coffin) {
object_parameter.parent = dungeon_room_5.coffin
}
} else if (object_parameter.name = "gold_key") {
if (not object_parameter.parent = castle_room_8.armor_statue) {
object_parameter.parent = castle_room_8.armor_statue
}
}
// etc 'else ifs' as needed
}
</function>
foreach (current_object_variable, ScopeVisibleNotHeldNotSceneryForRoom (game.pov.parent)) {
if (not (ListContains (game.pov.parent.default_objects_in_room_list, current_object_variable))) {
// something like this (syntax may not be correct but hopefully you get the idea, I'm too lazy at the moment to figure out the syntax needed):
game.pov.parent.description = game.pov.description + ". You notice {object:current_object_variable.name} out of the corner of your eye, spotting it for your first time, having missed it before."
}
}
You are in the bedroom. {if gun.scenery:There's a gun lying on the bed. }The lounge is to the north.
You are in the lounge. {if gun.lounge:There's a gun lying on the floor. }
<!--Saved by Quest 5.6.5621.18142-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="inroom">
<gameid>270c7386-0112-45d4-8af1-64bd1482dcb1</gameid>
<version>1.0</version>
<firstpublished>2016</firstpublished>
<attr name="autodescription_youcansee" type="int">0</attr>
<appendobjectdescription />
</game>
<object name="lounge">
<inherit name="editor_room" />
<description>A fine lounge.</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="gun">
<inherit name="editor_object" />
<take />
<inroomdescription>There's a gun lying on the bed.</inroomdescription>
<ontake type="script">
gun.inroomdescription = "There's a gun lying on the floor."
</ontake>
<ondrop type="script">
HandleSingleCommand ("look")
</ondrop>
</object>
</object>
</asl>
Pertex wrote:Hmm, then I don't understand your problem. You want to turn off the build-in object autolist but want to create a new object autolist? When should which object be displayed where?
You find yourself in an old, dusty hut. A workbench sits in the corner, on which lies a rusty machete.
You find yourself in an old, dusty hut.
You can see a workbench and a machete.
You are in the kitchen. Exits lie to the north and west.
> drop machete
You drop it.
> look
You are in the kitchen. Exits lie to the north and west.
The Pixie wrote:A way to do it would be to change ShowRoomDescription, and have it use one description if there is nothing in the room, and a second if there is. The second description might look like this:
"A workbench sits in the corner, on which lies %."
The function would replace "%" with whatever is in the room (which could use FormatObjectString as usual). Even better, ShowRoomDescription checks to see if there is a second description, and if not does some default tacked on to the end of the normal description.
That said, if you have any room descriptions that are scripts, not strings (and I tend to have a lot), you would also need to take account of that.
Forgewright wrote:I threw this together in about 20 min. It may not be what you want but it is how I do it. You can drop cup on floor or place cup on objects. When you look at objects you will get a response I think you'd prefer.
Pertex wrote:But what if you drop the machete in an other room than the workbench room? Then you would need another description for the machete. So you would need to script the description text for every object and room. And this is somthing OurJud don't want to do
<!--Saved by Quest 5.6.5783.24153-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="rooms">
<gameid>06e182d3-ba14-4b77-8244-afdec814dc23</gameid>
<version>1.0</version>
<firstpublished>2016</firstpublished>
</game>
<object name="lounge">
<inherit name="editor_room" />
<description>There is a long sofa here, with two matching chairs all facing the TV.</description>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<exit alias="south" to="kitchen">
<inherit name="southdirection" />
</exit>
<object name="hat">
<inherit name="editor_object" />
<take />
</object>
<object name="ball">
<inherit name="editor_object" />
<look>The lounge has a long sofa, and two matching chairs, all arranged around a large screen television.</look>
<take />
</object>
</object>
<object name="kitchen">
<inherit name="editor_room" />
<description>The kitchen has a cooker and sink. There is a table too.</description>
<lookwith>The kitchen has a cooker and sink. On the table you can see %.</lookwith>
<exit alias="east" to="workshop">
<inherit name="eastdirection" />
</exit>
<exit alias="north" to="lounge">
<inherit name="northdirection" />
</exit>
</object>
<object name="workshop">
<inherit name="editor_room" />
<description>The workshop is a mess, with bit of junk everywhere.</description>
<lookwith>The workshop is a mess, with bit of junk everywhere, including %.</lookwith>
<exit alias="west" to="kitchen">
<inherit name="westdirection" />
</exit>
</object>
<function name="ShowRoomDescription"><![CDATA[
if (HasScript(game.pov.parent, "description")) {
do (game.pov.parent, "description")
}
else {
objects = FormatObjectList("", GetNonTransparentParent(game.pov.parent), "and", "")
if (not objects = "" and HasString(game.pov.parent, "lookwith")) {
fulldesc = Replace(game.pov.parent.lookwith, "%", objects)
}
else {
fulldesc = game.pov.parent.description
if (not objects = "") {
fulldesc = fulldesc + " You can see " + objects + " here."
}
}
if (LengthOf(fulldesc) > 0) {
msg (fulldesc)
}
}
]]></function>
</asl>
The Pixie wrote:
No, you just code a generic description for all objects in the room. Here is an example game. In the lounge, objects are added to the description as normal, but in the klitchen and workshop, the "lookwith" attribute is used, and the objects are inserted into that.
Pertex wrote:"The Pixie"
I agree, that your solution works with lookwith in rooms. And inroom descriptions work with object.
Pertex wrote:
And his example "A workbench sits in the corner, on which lies a rusty machete." suggests that workbench and machete are normal objects and it's difficult to create one sentence with 2 or more objects.
OurJud wrote:TP, your test game appears to work very well, adding a far more colourful object description to a room, on look, than the default "You can see a ..."
Am I right in thinking all I need to do is copy & paste the ShowRoomDescription script into my own game?