About Formatting Object (Solved)

Selsynn
01 Sept 2018, 03:52

It seems I don't understand how to use the function FormatObjectList.
I have a container that has the characters the player can interact with (I use the ConvLib, if it's relevant) => ie the characters that are in the same room
And I want to display the list of the characters to the player (I don't want to use the Place And Object for other reasons.)

My code seems pretty simple, after I found the miraculous function (hum, I'm just saying that at first I thought it was a miraculous function)

if (ListCount(GetDirectChildren(Ball3DiversionCharacters))>0) {
  str = FormatObjectList("In the same room, there is: ", Ball3DiversionCharacters, Template("And"), ".")
  msg (str)
}
else {
  msg ("Isabella is alone")
}

And I get just the display of the alias (no formatting of displayverbs !)

If I change by

  str = FormatObjectList("In the same room, there is: ", Ball3DiversionCharacters, Template("And"),".", false)

as the documentation ( http://docs.textadventures.co.uk/quest/functions/corelibrary/formatobjectlist.html )informs

FormatObjectList (string pre-list, object parent, string pre-final, string post-list, boolean use inventory verbs)

I get a

Error running script: Error evaluating expression 'FormatObjectList("In the same room, there is: ", Ball3DiversionCharacters, Template("And"),".", false)': Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

Can somebody tip me on my error ?
Or how could I get to display all the displayverbs ?

Thanks ^^


mrangel
01 Sept 2018, 08:12

At the end of each turn, a javascript function automatically removes the links and displayverbs for all objects that are not in ScopeReachable().

If you want objects to have links without them also appearing in placesandobjects, you probably need to either add them to the backdrop scope script (on the "advanced scripts" tab for the game), or override the function UpdateObjectLinks.


Selsynn
01 Sept 2018, 17:27

Thank you, works like a charm as soon as I give the container behaviour at Ball3DiversionCharacters

And for the second problems, I raised it in another thread about the documentation