Game layout

Mikemuk01
17 Nov 2017, 10:52

Most of the games on here have colourful backgrounds and look more interesting than the standard Quest layout. Is this achieved with standard Quest commands or is it scripted?


K.V.
17 Nov 2017, 11:29

Hello,

To change the default colors (without changing the colors around during play):

http://docs.textadventures.co.uk/quest/ui-style.html


If you're looking for something a little more advanced and you like to code, this is what I do to change the font color and background color when changing rooms:

CLICK HERE FOR AN EXAMPLE GAME
<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Colorful">
    <gameid>2a90b648-95fe-46fa-a334-821380053da2</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
  </game>
  <object name="white room">
    <inherit name="editor_room" />
    <beforeenter type="script">
    </beforeenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <object name="black curtains">
      <inherit name="editor_object" />
    </object>
    <exit alias="north" to="gold room">
      <inherit name="northdirection" />
    </exit>
    <exit alias="southwest" to="purple room">
      <inherit name="southwestdirection" />
    </exit>
  </object>
  <object name="gold room">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.setBackground ("gold")
      JS.eval ("$('#divOutput').css('color', 'black');")
    </beforeenter>
    <onexit type="script">
      JS.setBackground (game.defaultbackground)
    </onexit>
    <exit alias="south" to="white room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="north" to="purple room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="purple room">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.setBackground ("purple")
      game.defaultforegroundbackup = game.defaultforeground
      game.defaultforeground = "gold"
      game.defaultlinkforegroundbak = game.defaultlinkforeground
      game.defaultlinkforeground = "white"
    </beforeenter>
    <onexit type="script">
      game.defaultforeground = game.defaultforegroundbackup
      game.defaultlinkforeground = game.defaultlinkforegroundbak
      JS.setBackground (game.defaultbackground)
    </onexit>
    <enter type="script">
    </enter>
    <exit alias="south" to="gold room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="northeast" to="white room">
      <inherit name="northeastdirection" />
    </exit>
  </object>
</asl>

http://docs.textadventures.co.uk/quest/ui-javascript.html


Mikemuk01
17 Nov 2017, 14:06

Thank you KV. Very helpful