Real XYZZY (Quest 5.8)

We can do silly things like this in Quest 5.8:


  <command name="real_xyzzy">
      message = "{once:Surprisingly, a menu appears.<br/><br/>}Where to?"
      rooms = ListExclude(AllRooms(), game.pov.parent)
      ShowMenu (message, rooms, true) {
        MoveObject (game.pov, GetObject(result))


This is not the "classic" XYZZY command. I just called it "real" because it really does something.

Couldn't this be done in the older versions or is it now integrated in Q5.8?

Hello, Pertex!

...and yes, sir. You are correct.

While adding this to 5.8, I searched the project for "AllRooms" in Visual Studio, to make sure I hadn't overlooked anything. I was surprised when some of the search results found the text in the Legacy files!

There was also a RESTART command, which is in 5.8, as well.

To be clear, the new bit is AllRooms. Legacy Quest understood rooms and items to be entirely different, hence a similar function was there.

KV, the ShowMenu function will handle objects in the list. In fact you can do all that in just three lines:

ShowMenu ("{once:Surprisingly, a menu appears.<br/><br/>}Where to?", AllRooms() - game.pov.parent, true) {
  MoveObject (game.pov, GetObject(result))

That's exactly what I was about to say :p (though I would have used ListExclude, because I still haven't got into the habit of using the + and - operators on lists)

I tried that first. (In fact, my code was nearly identical.)

I have a room named "second_room" with the alias "second room".

It either displayed "second_room" in the menu (which worked on click), or (after I fooled with the code a little) it showed the correct alias and it didn't work. So, I used this method. (Did I overlook something?)

I don't know what I was doing at first! This works perfectly fine (as Pixie has pointed out):

rooms = ListExclude(AllRooms(), game.pov.parent)
ShowMenu ("{once:Surprisingly, a menu appears.<br/><br/>}Where to?", rooms, true) {
  MoveObject (game.pov, GetObject(result))

List - Object

This crashes QuestJS games, so I habitually use ListExclude and ListCombine.

If list contains "one;two;three", and we use list - object, well... I don't know how JS reacts.

...but I know that list + objectturns it into the string "one;two;threeobject".

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