textadventures / quest

Create text adventure games
http://textadventures.co.uk/quest
MIT License
304 stars 69 forks source link

AllRooms() Does not Work in a Published Game #1202

Open KVonGit opened 1 month ago

KVonGit commented 1 month ago

In Quest 5.8, the function AllRooms() was added to return a list of rooms. (And yes: it was me who submitted this.)

The initial room object in English.template (and every other template) has a new boolean attribute: isroom which is set to true.

https://github.com/textadventures/quest/blob/f47a55b960082f559053209e1fbae7366e8f3036/WorldModel/WorldModel/Core/Templates/English.template#L12-L14


Any other room created is supposed to have isroom added and set to true by default -- unless you uncheck the checkbox in the editor.

This works when you play a game from the editor, but any newly created room's isroom attribute does not carry over into a published game.


image


image


image


The Issue

I added isroom to the editor_room type, thinking it would carry over.

https://github.com/textadventures/quest/blob/f47a55b960082f559053209e1fbae7366e8f3036/WorldModel/WorldModel/Core/CoreEditor.aslx#L19-L21


I just now unwittingly happened to use AllRooms() in a test game and discovered this issue.

I searched the forum for "AllRooms", but I didn't get any results with anyone talking about this not working.


I made an example game, just for this issue. I turned on DevMode and left it on when I published the game. (It still works fine after publishing a game; it just doesn't have the GUI.)

Here is a link to play it from the editor: https://play.textadventures.co.uk/Play.aspx?id=editor/81f17eb0-ebd0-4aa6-981f-828287f15e46%2fAllRooms+Only+Works+in+the+Editor.aslx

image


And here is a link to play the published version: https://play.textadventures.co.uk/Play.aspx?id=9f_y-hmjmewmzd2mvrlixg

image


As stated, I just discovered this, and I can't think of any possible fixes at this moment.

KVonGit commented 1 month ago

Test game:

<!--Saved by Quest 5.8.9010.29474-->
<asl version="580">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="AllRooms Only Works in the Editor?">
    <inherit name="devmode" />
    <gameid>3fbf822c-779c-4ac6-987f-af46c552cbb2</gameid>
    <version>0.0.1</version>
    <firstpublished>2024</firstpublished>
    <menufont>Georgia, serif</menufont>
    <subtitle>v{game.version}</subtitle>
    <author>kv</author>
    <description><![CDATA[Test game.<br/><br/>Playing from the editor (whether online or in the desktop version), AllRooms() will return room, foo, and bar. But in the published game, it will only return room.]]></description>
    <feature_devmode />
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <isroom />
    <description>{command:testme}</description>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
  </object>
  <object name="foo">
    <inherit name="editor_room" />
  </object>
  <object name="bar">
    <inherit name="editor_room" />
  </object>
  <command name="testme_cmd">
    <pattern>testme;test me</pattern>
    <script>
      msg ("AllRooms():")
      msg (AllRooms())
    </script>
  </command>
</asl>

The .aslx file: AllRoomsTester.zip

The .quest file: https://textadventures.co.uk/games/download/9f_y-hmjmewmzd2mvrlixg