Integrating favourite libraries into the core of quest 5.8 "core3"

So I realized that I've been sort of cataloging my journey on integrating my favourite libraries into the core on my "too many tabs" topic, and that was foolish. Now someone who only cared about making tabs toggle-able instead of permanent has all sorts of stuff they might not care about reading that relates to integrating a whole set of libraries into the core. SMH

Anyway, that's here: https://textadventures.co.uk/forum/samples/topic/y_eruu9bp0mq498lw7tknq/too-many-tabs-adding-your-library-tabs-to-the-features-tabs-so-they-can-be-to

But now I'll put stuff in a real topic devoted to integrating your favourite libraries into the core.

This process can:
1. reduce the number of tabs altogether, placing controls on pre-existant tabs (eg. LiquidLib)
2. inspire you to create new controls in the editor for overriding/working with your fav modifications on your fav libraries
(eg. mana, player-stats, or customisable monster scripts, etc. in CombatLib)
3. reduce/nullify the setup a library needs before it will work (eg CombatInitialise, InitInv2, Scopebackdrop, & WeatherLib
setup)
4. reduce the amount of things the library user needs to remember, or go to documentation for, when they want to use the
library (because they're added to the editor and controls)

Remember before editing the core to save a copy of it somewhere pristine, especially the "core.aslx" file itself, as the others can be renamed to sit side-by-side one another comfortably, but this one can't easily and so modified versions will replace eachother. Simply add a number to the edited core file for version, and update the "includeref" code in "core".

So far, I've updated these files in my "core3" ("core2" was for just integrating the tabs onto the "features"):

       "CoreCommands3.aslx (now includes many commands added by libraries)
       "CoreFunctions3.aslx (now includes many functions added by libraries)
        "CoreTypes3.aslx" (now includes many types added by libraries)
        "CoreStatusAttributes3.aslx"  (Auto-adds additional CombatLib attributes when enabled, hitpoints, mana, xp)
        "CoreOutput3.aslx"  (includes integrations of Output Text Paragraph, and MessagePlus libraries, etc created by EightOne)
        "CoreCombat3.aslx" (includes surprisingly few integration components as most of CombatLib actually ended up being 
                                                     included in other areas of the core)
        "CoreEditor3.aslx" (calls updated editors and additional editors "tabs"  from libraries)
        "CoreWearable3.aslx" (includes some portions of CombatLib which are needed for wearable types)
        "CoreEditorGame3.aslx" (Includes features checkboxes to enable libraries/tabs, also statnames string dictionary editor on 
                                                           the player tab--WhenCombatLib enabled)
        "CoreEditorObject3.aslx" (updated to call the modified and integrated editor tabs)
        "CoreEditorExit3.aslx"  (includes calling descriptions tab if some of my personal libraries are added/enabled--intend to 
                                                        eventually determine what happened to MrAngel's ExitDescriptionsLib when the other libraries 
                                                        were enabled that killed it and integrate his awesome checkboxes too this is one is not neccessary 
                                                        really as it stands) 
        "CoreEditorScripts3.aslx" (includes integration of some of EightOne's editor libraries)
        "CoreEditorObjectSetup3.aslx" (now includes some additional checkboxes and type dropdowns depending upon 
                            library/feature integration)
        "CoreEditorObjectRoom3.aslx"(now includes smell and listen scripts for the room ambiance)
        "CoreEditorObjectFeatures3.aslx" (Includes checkboxes for toggling those tabs/enabling integrated library 
                            features as discussed in the other forum post)
        "CoreEditorObjectUseGive3.aslx" (integrates the editions of  EightOne's "UseAllRound" library)
        "CoreEditorObjectContainer3.aslx" (includes the LiquidLib tab portions for objects)
        "CoreEditorObjectWearable3.aslx"(now includes wearable types from CombatLib and relevant editor pieces)
        "CoreEditorObjectOptions3.aslx" (I honestly can't remember what--if anything-- I updated here)
         "CoreEditorObjectLift3.aslx" (this is what's left of LiftLib's tab after integrating the rest of the library--only appears if a 
                                                                     room or object given a "Lift type" with dropdown on the setup tab)
         "CoreEditorObjectStack3.aslx" (same as above, remaining bits of a tab from a Pixie library)
         "CoreEditorObjectWeather3.aslx" (same as above, remaining bits of the tab from latest upgraded WeatherLib)
         "CoreEditorObjectHoly3.aslx" (Tab from one of my personal libraries for a game I'm working on. It wouldn't be in 
                            something posted to the site as a finished product and probably wouldn't interest most folks to use it.)
         "CoreEditorObjectNpcandPostures3.aslx" (All that's left of editor tabs from Pixie's various NPC and Postures 
                            libraries)
         "CoreEditorObjectConversation3.aslx (all that's left of ConversationLib is the Conversation tab as this file... as I 
                          make this list, I wonder if this can disappear altogether by integrating it with "CoreEditorObjectAskTell"... I'll be 
                          looking into that)

        For CoreEditorScripts, I plan to eventually learn and integrate further some very commonly called functions and used 
                                                       attributes from libraries (like CombatLib) but I'm not there yet.
         "CoreEditorScriptsOutput3.aslx" (Includes EightOne library integrations)
         "CoreEditorScriptsObjects3.aslx"(Includes EightOne library integrations)
         "CoreEditorScriptsScripts3.aslx" (Includes EightOne library integrations)

Advanced folks can do their own versions of things to make their lives easier.

Newbies could conceivably use a polished version of these updates as a standard set to just have more available to them without much coding... although I LOVE how Quest and all the current documentation and using these libraries has taught me what little I know about coding.

Still working this project, but having a blast!


Sorry, it uglified the part in the box there :/


Latest little side-quest as I work on this. Pixie's CombatLib mentions fungi, but didn't actually have any...
Since I was a Moria/Angband/Zangband player before windows stopped handling it well, I have an affinity for mushrooms that do stuff in games.

So.... I added a Fungus Type which works with some of Pixie's (modified) functionality in my core3 update.

First thing was to update the "edible" type slightly. (Some of the edits are merely to incorporate other features of Pixie's CombatLib like Hitpoints and Mana) It can be found in CoreTypes3.aslx

  <type name="edible">
    <displayverbs type="listextend">[Eat]</displayverbs>
    <inventoryverbs type="listextend">[Eat]</inventoryverbs>
    <eat type="script">
      if (HasInt(this, "lastsfor")) {
        do (this, "starteateffect")
      }
      else if (HasScript(this, "eateffect")) {
        do (this, "eateffect")
      }
      if (HasInt(game.pov, "health")) {
        game.pov.health = game.pov.health + this.eathealth
      }
      if (HasInt(game.pov, "hitpoints")) {
        game.pov.hitpoints = game.pov.hitpoints + this.eathealth
      }
      if (HasInt(game.pov, "mana")) {
        game.pov.mana = game.pov.mana + this.eatmana
      }
      if (HasString(this, "eatmsg")) {
        msg (this.eatmsg)
      }
      else {
        msg (DynamicTemplate("Eaten", this))
      }
      if (HasScript(this, "tastedesc")) {
        do (this, "tastedesc")
      }
      if (HasInt(this, "lastsfor")) {
        MakeObjectInvisible (this)
      }
      else {
        destroy (this.name)
      }
    </eat>
    <eathealth type="int">0</eathealth>
    <eatmana type="int">0</eatmana>
  </type>

Next (conceptually) was to make a Fungus Type, which could be selected from the Edible Tab's dropdown:

  <type name="fungus">
      <inherit name="editor_object" />
      <inherit name="edible" />
      <inherit name="merchandise" />
      <inherit name="useasother" />
      <feature_edible />
      <feature_combat />
      <scenery type="boolean">false</scenery>
      <feature_usegive />
      <useasotherverb>eat</useasotherverb>
      <sense_able />
      <attr name="status_descriptions" type="boolean">false</attr>
      <destroyonsale />
      <starteateffect type="script">
        do (this, "eateffect")
        game.pov.currentbelly = this
        game.pov.eateffcountdown = this.lastsfor
        if (GetBoolean(this, "cannothold")) {
          DropEverything
        }
        if (HasObject(this, "specialattack")) {
          game.pov.equipped = this.specialattack
        }
      </starteateffect>
      <endeateffect type="script">
        game.pov.currentbelly = null
        if (HasScript(this, "terminate")) {
          do (this, "terminate")
        }
        if (HasObject(this, "specialattack")) {
          game.pov.equipped = fists
        }
        destroy (this.name)
      </endeateffect>
  </type>

The Edible Tab now needs updated as such to better include CombatLib... It can be found in CoreEditorObjectOptions3:

  <tab>
    <parent>_ObjectEditor</parent>
    <caption>[EditorObjectOptionsEdible]</caption>
    <mustnotinherit>editor_room</mustnotinherit>
    <onlydisplayif>this.feature_edible</onlydisplayif>

    <control>
      <controltype>dropdowntypes</controltype>
      <caption>[EditorObjectOptionsEdible2]</caption>
      <types>*=[TypeCannotEaten]; edible=[TypeCanEaten]; fungus=Fungus</types>
    </control>
    <control>
      <controltype>number</controltype>
      <attribute>eathealth</attribute>
      <caption>[EditorObjectOptionsChangehealth]</caption>
      <mustinherit>edible</mustinherit>
      <onlydisplayif>game.showhealth or game.feature_DescriptionsTab</onlydisplayif>
    </control>
    <control>
      <controltype>number</controltype>
      <attribute>eatmana</attribute>
      <caption>Change Mana by</caption>
      <mustinherit>edible</mustinherit>
      <onlydisplayif>game.feature_mana</onlydisplayif>
    </control>
    <control>
      <controltype>textbox</controltype>
      <attribute>eatmsg</attribute>
      <caption>[EditorObjectOptionsMessageEat]</caption>
      <nullable/>
      <mustinherit>edible</mustinherit>
    </control>

    <control>
      <controltype>script</controltype>
      <caption>Eat Effect (what happens when eaten)</caption>
      <attribute>eateffect</attribute>
      <mustinherit>edible</mustinherit>
    </control>
    <control>
      <controltype>label</controltype>
      <caption>Below are for use if the fungus has a turn-limited effect.</caption>
      <mustinherit>fungus</mustinherit>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Last for (turns)</caption>
      <attribute>lastsfor</attribute>
      <width>100</width>
      <mustinherit>fungus</mustinherit>
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>script</controltype>
      <caption>Script to run when the effect has finished (remember to also include a message to describe any changes)</caption>
      <attribute>terminate</attribute>
      <mustinherit>fungus</mustinherit>
    </control>
    <control>
      <controltype>checkbox</controltype>
      <caption>Cannot hold anything during effect?</caption>
      <attribute>cannothold</attribute>
      <mustinherit>fungus</mustinherit>
      <nullable/>
    </control>


  </tab>

And so as you review these type and tab changes (if you're familiar with CombatLib) you can see that it uses something very similar to his lasting magic effect/potion effect system.

The scripts on the fungus starteateffect and endeateffect are versions of startmagiceffect and endmagiceffect from the type "magicaleffectprovider"

This means that in CombatStuff3.xml in the "attacktheplayerturnscript" you need to add some code similar to that which handles "magiccountdown"

        // Check for Edible effect expiring
        if (not HasInt(game.pov, "eateffcountdown")) {
          game.pov.eateffcountdown = 0
        }
        if (game.pov.eateffcountdown > 0) {
          game.pov.eateffcountdown = game.pov.eateffcountdown - 1
          if (game.pov.eateffcountdown < 1) {
            do (game.pov.currentbelly, "endeateffect")
          }
        }

et voila! You now have several CombatLib options related to your edibles which are easily adjustable in the editor:

You can use the same exact health attribute to add/subtract from Hitpoints that was already in the core
You can perform the same behaviors with a mana attribute
You can give any edible an "eateffect" script

You can turn your edible into a fungus by selecting "fungus" instead of "edible" in the dropdown and add the additional functionality of making the "eateffect" last a specified number of turns like a spell or potion.

It also includes "tastedesc" description/script if you're using my senses or the updated weatherlib. You can delete that row if not wanting to use or change it if you've got your own senses worked out in your game.

Also, to have the game recognize whether you've selected to use Shops, Combat, or Mana, etc. and update the appropriate attributes I've modified CoreStatusAttributes3 as follows:

  <function name="InitStatusAttributes">
    <![CDATA[
    if (game.showscore) {
      game.score = 0
      if (game.statusattributes = null) {
        game.statusattributes = NewStringDictionary()
      }
      dictionary add (game.statusattributes, "score", "[Score]: !")
    }

    if (game.feature_DescriptionsTab) {
      game.pov.xp = 0
      if (game.povstatusattributes = null) {
        game.povstatusattributes = NewStringDictionary()
      }
      dictionary add (game.povstatusattributes, "xp", "XP: !")
    }

    if (game.showhealth) {
      if (game.povstatusattributes = null) {
        game.povstatusattributes = NewStringDictionary()
      }
      dictionary add (game.povstatusattributes, "health", "[Health]: !%")
    }

    if (game.feature_DescriptionsTab) {
      if (game.povstatusattributes = null) {
        game.povstatusattributes = NewStringDictionary()
      }
      dictionary add (game.povstatusattributes, "hitpoints", "Hitpoints: !")
    }

    if (game.feature_mana) {
      game.pov.mana = 0
      if (game.povstatusattributes = null) {
        game.povstatusattributes = NewStringDictionary()
      }
      dictionary add (game.povstatusattributes, "mana", "MP: !")
    }

    if (game.showmoney) {
      if (game.povstatusattributes = null) {
        game.povstatusattributes = NewStringDictionary()
      }
      dictionary add (game.povstatusattributes, "money", "[Money]: !")
    }
    if (HasAttribute(game, "feature_ShopLib")) {
      set (game, "moneyformat", "£!1.2!")
    }
    ]]>
  </function>

I've also added some "player" combat controls to the combat tab based on following Pixie's documentation and attributes he tells you are available.

    <!-- Player -->
    <control>
      <controltype>checkbox</controltype>
      <caption>Has venom glands?</caption>
      <attribute>haspoisonglands</attribute>
      <mustinherit>editor_player</mustinherit>
    </control> 
    <control>
      <controltype>textbox</controltype>
      <caption>Display when player tries to talk if this player object cannot talk</caption>
      <attribute>gagstring</attribute>
      <mustinherit>editor_player</mustinherit>
    </control>
    <control>
      <controltype>objects</controltype>
      <caption>Starting Weapon</caption>
      <attribute>equipped</attribute>
      <mustinherit>editor_player</mustinherit>
    </control>
    <control>
      <controltype>objects</controltype>
      <caption>Starting Shield</caption>
      <attribute>shield</attribute>
      <mustinherit>editor_player</mustinherit>
    </control>
    <control>
      <controltype>textbox</controltype>
      <caption>Starting Status effect</caption>
      <attribute>status</attribute>
      <mustinherit>editor_player</mustinherit>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Starting Hitpoints</caption>
      <attribute>hitpoints</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Starting Mana Points</caption>
      <attribute>mana</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <onlydisplayif>game.feature_mana</onlydisplayif> 
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Starting Mana Max</caption>
      <attribute>mana_max</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <onlydisplayif>game.feature_mana</onlydisplayif> 
      <minimum>1</minimum>
    </control>	
    <control>
      <controltype>number</controltype>
      <caption>Starting Mana Bonus</caption>
      <attribute>mana_bonus</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <onlydisplayif>game.feature_mana</onlydisplayif> 
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Default Strength</caption>
      <attribute>strength</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Default Agility</caption>
      <attribute>agility</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Default Stamina</caption>
      <attribute>stamina</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <minimum>1</minimum>
    </control>
    <control>
      <controltype>number</controltype>
      <caption>Default Intelligence</caption>
      <attribute>intelligence</attribute>
      <width>100</width>
      <mustinherit>editor_player</mustinherit>
      <minimum>1</minimum>
    </control>

Eventually I'll work out the best way to integrate the recipe/venom system so that creators who wish to use that functionality that Pixie created don't have to work so hard to made additional recipes and venom. It's on a to-do list, but so are many other things that look more fun to me. For now, player venom is easy to toggle, congratulations, you can spit on your weapon now.

I'm also planning to work out the best way to deal with "fists" in case creators want to easily change/modify the default "unequipped" attack object.

Have added to the editor on "CoreEditorGame3.aslx" so that you can easily add/remove status attribute names in the dictionary that Pixie has you set up in the documentation. It's now on the Player tab:

    <tab>
      <caption>[EditorGamePlayer]</caption>
      <advanced/>

      <control>
        <caption>[EditorGamePlayerobject]</caption>
        <attribute>pov</attribute>
        <controltype>objects</controltype>
        <advanced/>
      </control>

      <control>
        <onlydisplayif>game.pov = null</onlydisplayif>
        <advanced/>
        <controltype>label</controltype>
        <caption>[EditorGameIfnoplayer]</caption>
      </control>

      <control>
        <controltype>script</controltype>
        <attribute>onhealthzero</attribute>
        <onlydisplayif>game.showhealth</onlydisplayif>
        <caption>[EditorGameScripttorun]</caption>
      </control>

      <control>
        <controltype>textbox</controltype>
        <caption>[EditorGameMoneyformat]</caption>
        <attribute>moneyformat</attribute>
        <onlydisplayif>game.showmoney</onlydisplayif>
        <width>50</width>
      </control>
      
      <control>
        <controltype>stringdictionary</controltype>
        <caption>[EditorGamePlayerobjectStatus]</caption>
        <keyprompt>[EditorGameAttributesPleaseenter]</keyprompt>
        <valueprompt>[EditorGameAttributesPleaseenter2]</valueprompt>
        <attribute>povstatusattributes</attribute>
        <advanced/>
      </control>
      <control>
        <controltype>stringdictionary</controltype>
        <caption>Stat Names</caption>
        <keyprompt>attribute name</keyprompt>
        <valueprompt>Name for attribute player sees</valueprompt>
        <attribute>statnames</attribute>
        <advanced/>
      </control>
    </tab>

And checked that ondeath mechanism incorporates xp

I wanted to make a help commands editor, but it's currently beyond me. If anyone knows how to create controls in the game object editors that would be able to override commands? Otherwise, it might just be that people have to override those the "hard" way.

But if Pixie mentioned in his documentation to create or override a script, I've already added them or plan to add them to the editors in the appropriate places.

Anyway, here's hoping that this stuff is interesting/useful to someone.


Log in to post a reply.

Support

Forums