ThePix / QuestJS

A major re-write of Quest that is written in JavaScript and will run in the browser.
MIT License
66 stars 13 forks source link

Making an object not visible? #30

Closed KVonGit closed 3 years ago

KVonGit commented 3 years ago

Is there a built-in way to make an object invisible?

In Quest 5, we could set visible to false, but I can't find anything that does that in this code.

I cheated like this:

createItem("destinations",{
    loc:"hub",
    examine:()=>metamsg(`You can't see that.`),
    scenery:true,
    excludeFromAll:true,
    take:()=>metamsg(`You can't see that.`)
});

If there's a legitimate method, I'd rather not hack. Else, it's no big deal. This is one of the few times I'd want to do this anyway.

ThePix commented 3 years ago

You can always delete the line:

loc:"hub",

Why would you want it to be in the location, but not visible?

KVonGit commented 3 years ago

Why would you want it to be in the location, but not visible?

I don't remember what we did with that destinations object in the Quest Group Project.

  <object name="hub">
    <inherit name="editor_room" />
    <attr name="feature_startscript" type="boolean">false</attr>
    <usedefaultprefix type="boolean">false</usedefaultprefix>
    <description type="script">
      DescribeHub
    </description>
    <enter type="script">
      HubEnterScript
      game.pov.dimension = this
    </enter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
      <isfemale type="boolean">false</isfemale>
      <race>human</race>
      <attr name="pov_look" type="script">
        DescribePlayer
      </attr>
    </object>
    <command name="TravelFromHub">
      <pattern>travel;t</pattern>
      <script>
        ShowMenu ("Travel to where?", GetDirectChildren(destinations), true) {
          msg (TravelToHub.travelmsg)
          dest = GetObject(result)
          player.parent = dest.to
          player.dimension = dest.to
        }
      </script>
    </command>
    <object name="destinations">
      <inherit name="editor_object" />
      <visible type="boolean">false</visible>
    </object>
  </object>
  <object name="gateway">
    <inherit name="gateway_type" />
    <inherit name="editor_room" />
    <attr name="feature_startscript" type="boolean">false</attr>
    <gateway />
    <attr name="_initialise_" type="script">
      AddToHubGateway (this)
    </attr>
  </object>

I'm just trying to port that main game and library over to the new stuff.

I already have a haphazard way to send data from game to game via url, mostly based on your old code from different places.

I think we'd have to fake the newly added exits to different "dimensions". I'm thinking of cloning a fake exit object, making the name something like "exit to the north". Then, hijacking the GO NORTH command in that room so it actually loads a url to a new game while transferring some attribute data along the way.

Digressions aside, I was just copying your old objects and such from the group project. That destinations object was marked visible=false, and I began to search for such a setting in the new Quest code.

It's no big deal at all. I figured out how to fake it, and I may not even use it. I just wanted to make sure I wasn't overlooking anything.

ThePix commented 3 years ago

I already have a haphazard way to send data from game to game via url, mostly based on your old code from different places.

There is a help page about this, but it assumes the game is hosted as a web page, rather than on textadventures https://github.com/ThePix/QuestJS/wiki/Chaining-Several-Games-Together