Creating a Library [Unsolved]

Hello!

So right off the bat, I know how to create libraries for FUNCTIONS.

<library>
Function Here
</library>

But I was curious if this is the format I use for VERBS, COMMANDS, TURNSCRIPTS etc, or if those have a different format.

Thank you so much for any replies. I appreciate it!

Anonynn.


Anything that you can put at the top level can be put in a library.

When publishing, the editor replaces the <include /> tag with the entire contents of the library, so it's exactly the same as having them all in one file.


(filler for getting my post, update/posted)


the only things you do NOT put into a library:

  1. the core engine library files ('include ref' of 'English.aslx' and 'Core.aslx')
  2. the special, and required (for the game file only) 'game' global settings and publishing info Object
  3. the default 'room' Room Object
  4. the default 'player' Player Object

Game File:

https://docs.textadventures.co.uk/quest/asl_requirements.html

<asl version="550">

  <!--
  REQUIRED:
  -->

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <!--
  OPTIONAL:
  -->

  <delegate name="NAME_OF_DELEGATE" />

  <!--
  REQUIRED:
  -->

  <game name="NAME_OF_GAME">
  </game>

  <object name="room">

    <inherit name="editor_room" />

  </object>

  <object name="player">

    <inherit name="editor_object" />
    <inherit name="editor_player" />

    <attr name="parent" type="object">room</attr>

  </object>

  <!--
  OPTIONAL:
  -->

  <object name="NAME_OF_ANOTHER_PLAYER_OBJECT">

    <inherit name="editor_object" />
    <inherit name="editor_player" />

  </object>

  <object name="NAME_OF_OBJECT">
  </object>

  <function name="NAME_OF_FUNCTION">
  </function>

  <command name="NAME_OF_COMMAND">
  </command>

  <verb name="NAME_OF_VERB">
  </verb>

  <turnscript name="NAME_OF_TURNSCRIPT">
  </turnscript>

  <timer name="NAME_OF_TIMER">
  </timer>

</asl>

VS


Library File:

<library>

  <!--
  OPTIONAL:
  -->

  <delegate name="NAME_OF_DELEGATE" />

  <object name="NAME_OF_ANOTHER_PLAYER_OBJECT">

    <inherit name="editor_object" />
    <inherit name="editor_player" />

  </object>

  <object name="NAME_OF_OBJECT">
  </object>

  <function name="NAME_OF_FUNCTION">
  </function>

  <command name="NAME_OF_COMMAND">
  </command>

  <verb name="NAME_OF_VERB">
  </verb>

  <turnscript name="NAME_OF_TURNSCRIPT">
  </turnscript>

  <timer name="NAME_OF_TIMER">
  </timer>

</library>

you can nest libraries within libraries:

'my_game.aslx' // game file

<asl version="550">

  <include ref="English.aslx" />
  <include ref="Core.aslx" />

  <include ref="hub.aslx" />

  <game name="NAME_OF_GAME">
  </game>

  <object name="room">

    <inherit name="editor_room" />

  </object>

  <object name="player">

    <inherit name="editor_object" />
    <inherit name="editor_player" />

    <attr name="parent" type="object">room</attr>

  </object>

</asl>

'hub.aslx' (like 'Core.aslx')

<library>

  <include ref="race.aslx" />
  <include ref="equipment.aslx" />
  <include ref="magic.aslx" />
  <include ref="monster.aslx" />
  <include ref="world.aslx" />

</library>

'race.aslx'

<library>

  // RACE CONTENT

</library>

'equipment.aslx'

<library>

  // EQUIPMENT CONTENT

</library>

'magic.aslx'

<library>

  // MAGIC CONTENT

</library>

'monster.aslx'

<library>

  // MONSTER CONTENT

</library>

'world.aslx'

<library>

  // WORLD CONTENT

</library>

unfortunately, I don't think quest has a 'ifdef/ifnotdef' feature for its libraries, so you got to be careful with how you construct them, libraries can be very complicated... especially when you don't have this feature to help/protect you with using libraries (redundant code/libraries, conflicts, etc)

also, if libraries are made dependent on other libraries, than the order of 'include ref' order (vertical heirarchy), matters

lastly... don't make my mistake of confusing/mixing-up the use of 'include ref' and 'inherit name'... I was confused for a long time as to why I was getting errors... lol


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

Support

Forums