Troubles with FormatObjectList (SOLVED)

kurto321
01 Sept 2018, 11:07

Hi guys, I asked about this a year or two ago, and I'd look at the code for it on a similar old game I was working on back then but I don't have access to the laptop it's on right now - apologies for needing to ask!

I'm working on a game where instead of typed commands, the game is navigated by clicking hyperlinks. Right now i'm making an object in the player's inventory called '(Action) Look Around'. When used, it's meant to print "Objects of interest include Object1, Object2, and Object3." with the three objects being objects in the room and having hyperlinks so they can be interacted with.

I'm currently using the web browser version of Quest, so I apologise if my problem is an issue with that.
What my problem is exactly, is that i'm having trouble getting FormatObjectList to work properly.

In the player object's inventory is an object called '(Action) Look Around'. This object has a verb called 'Look Around'. When used, this verb is supposed to run a script which calls a function - FormatObjectList.

The parameters are:
"You can see", player.parent, "and", "in this room.", false

It's supposed to print the objects in the same room as the player object (with hyperlinks), but when I attempt to use it in-game, it prints:

look around (Action) Look Around
Error running script: Too many parameters passed to FormatObjectList function - 5 passed, but only 4 expected

What am I getting wrong and how can I get it to work? I'll include some reference images.

https://imgur.com/a/Y4C6DMf

Thanks in advance!


mrangel
01 Sept 2018, 12:04

You're passing too many parameters to FormatObjectList, like the error message says.

Remove the "false" last parameter and the error message will go away.

However, FormatObjectList returns a string. It doesn't display it on the screen.

If you want the verb to do anything, the code should be:

msg (FormatObjectList ("You can see", player.parent, "and", "in this room."))

(If you prefer to avoid code view, that would be "Print a message" or whatever it's called, [expression], and the expression is FormatObjectList ("You can see", player.parent, "and", "in this room."))


kurto321
01 Sept 2018, 12:35

Thank you! It turns out I was forgetting that I need to run a script to print a message as an expression! A few tweaks later and it's working as intended. Again, thank you!


Selsynn
01 Sept 2018, 17:23

I had the same trouble with the function. Could someone correct the official documentation here http://docs.textadventures.co.uk/quest/functions/corelibrary/formatobjectlist.html
Because it give the wrong prototype