Printing the health variable

Hopefully this is a simple thing I'm getting confused about. I'm simply trying to print the health variable out when the user types 'health'. I tried this via adding a command, but it doesn't seem to recognise the variable player.health from there.

FYI, I'm avoiding the status UI windows as I'm going for that old school look.

On a side note, is there a way to add some text to the beginning of the command bar before the cursor?


Did you enable health?


<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Printing Health Value">
    <gameid>deec62e5-2a4d-4293-afff-57275e566c30</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <showhealth />
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <enter type="script">
    </enter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
  </object>
  <command name="diagnose">
    <pattern>health;show health;display health;diagnose</pattern>
    <script>
      msg ("DEBUGGING MESSAGE:")
      msg ("Your health is "+player.health+".")
      msg ("DEBUGGING MESSAGE:alternate1:")
      msg ("Your health is {player.health}.")
      msg ("DEBUGGING MESSAGE: alternate2:")
      msg ("Your health is "+game.pov.health+".")
      msg ("DEBUGGING MESSAGE: alternate3:")
      msg ("Your health is {game.pov.health}.")
    </script>
  </command>
</asl>

a way to add some text to the beginning of the command bar before the cursor?

If you checked Use a cursor instead of a box for commands, look at the very bottom of this screenshot:


If you didn't change the command prompt, you can change the text inside of it like this:

JS.setInterfaceString ("TypeHereLabel", "Please enter a command.")
JS.setInterfaceString ("TypeHereLabel", "Please answer the NPC's question.")
JS.setInterfaceString ("TypeHereLabel", "Type here...")

Log in to post a reply.

Support

Forums