to print a description of available objects

insidethecircle
22 Aug 2011, 12:54
here's how it worked for me in quest 4, but im not having much luck so far on quest 5...

If "#quest.formatobjects#" is not equal to "" Then Print "There is also #quest.formatobjects# here."

assistance would be greatly appeciated:)

Alex
22 Aug 2011, 13:34
You can use one of the Scope functions to iterate over all objects - ScopeVisibleNotHeldNotScenery is probably the closest match, as it will be all visible objects in the current room which are not held by the player, and are not scenery objects.

Then you can use foreach to build your string how you want it.

When printing room descriptions, Core.aslx uses the FormatObjectList function so you could also use that.

insidethecircle
23 Aug 2011, 11:44
thanks alex.
is there a chance to show it in a script/code ?
i cant speak for anyone else but i find it so much easier to understand the procedures when i can follow something.
(if i could find an emoticon with big white hat with a 'D' on it i'd be using it right now:)

Alex
23 Aug 2011, 11:54
Well it depends exactly what you're trying to do...

You can call FormatObjectList just like any other function. In the script editor, add "Call function", then enter the name FormatObjectList. Add the parameters in order, e.g. "You can see", player.parent, "and", "in this room.", false.

formatobjectlist.png

insidethecircle
23 Aug 2011, 11:58
why thank you kindly:)
ill have a run around it tonight.

insidethecircle
24 Aug 2011, 11:51
ok. ive put together a basic script - but im not sure how to get the command 'test' to print the FormatObjectList when the game is running...

<!--Saved by Quest Editor v5.0-->
<asl version="500">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="test">
<autodescription type="boolean">false</autodescription>
</game>
<object name="room">
<inherit name="editor_room" />
<description>you are in a room</description>
<object name="player">
<inherit name="defaultplayer" />
</object>
<object name="bat">
<inherit name="editor_object" />
<take />
</object>
<object name="ball">
<inherit name="editor_object" />
<take />
</object>
</object>
<command>
<script>
FormatObjectList ("You can see", player.parent, "and", "in this room.", false)
</script>
<pattern>test</pattern>
</command>
</asl>

Alex
24 Aug 2011, 12:34
It's a function which returns a value so you need to print it. I think I probably misadvised you I'm afraid :oops: ... don't use the "call function" command, instead you just need to call the FormatObjectList function in the expression for "Print a message"

insidethecircle
25 Aug 2011, 11:55
oh thanks i thought it was me:)