Library - Tabs and Tabulations

Doctor Agon
24 Apr 2019, 15:13

Hi, I'd like to have a go at making my own library, complete with checkboxes and tabs that I've created and/or using existing tabs that are already in use in the core game, or in various libraries; Pixies probably.
I can probably have a look at the code for Pixies library tabs and see which ones she uses, but is there a list of tabs used in the core code and how easy (or difficult) is it attaching a new box to an existing tab?


The Pixie
24 Apr 2019, 15:48

I have never found a way to add anything to an existing tab.

Have you seen the docs for tabs?
http://docs.textadventures.co.uk/quest/tabs_for_types.html


Doctor Agon
25 Apr 2019, 19:15

Hi Pixie, trying to follow that example - tutorial, re-spell. Keep getting this error

Error running script: Error compiling expression 'ListCombine(baselist, verbs)': FunctionCallElement: Could find not function 'ListCombine(QuestList`1, QuestList`1)'
Error running script: Error evaluating expression 'Join(GetDisplayVerbs(object), "/")': Value cannot be null.Parameter name: values
Error running script: Error compiling expression 'ListCombine(baselist, verbs)': FunctionCallElement: Could find not function 'ListCombine(QuestList`1, QuestList`1)'
You are in a room.
You can see fireball spell.
Error running script: Error compiling expression 'ListCombine(baselist, verbs)': FunctionCallElement: Could find not function 'ListCombine(QuestList`1, QuestList`1)'
Error running script: Error evaluating expression 'Join(GetDisplayVerbs(object), "/")': Value cannot be null.Parameter name: values
Error running script: Error compiling expression 'ListCombine(baselist, verbs)': FunctionCallElement: Could find not function 'ListCombine(QuestList`1, QuestList`1)'
Error running script: Error evaluating expression 'Join(GetDisplayVerbs(object), "/")': Value cannot be null.Parameter name: values
Error running script: Error compiling expression 'ListCombine(baselist, verbs)': FunctionCallElement: Could find not function 'ListCombine(QuestList`1, QuestList`1)'

Not sure what I've done wrong.

Edit:
Been playing around with the first section on this page:
http://docs.textadventures.co.uk/quest/tabs_for_types.html

<?xml version="1.0"?>
  <library>
    <type name="spell">
      <inventoryverbs type="list">Cast</inventoryverbs>
      <displayverbs type="list">Learn</displayverbs>
      <drop type="boolean">false</drop>
      <take type="boolean">false</take>
      <usedefaultprefix type="boolean">false</usedefaultprefix>
      <learn type="script"><![CDATA[
        if (not this.parent = player) {
          this.parent = player
          msg ("In a process that seems at once unfathomable, and yet familiar, the spell fades away, and you realise you are now able to cast the <i>" + this.alias + "</i> spell.")
        }
        else {
          msg ("Er, you already know that one!")
        }
      ]]></learn>
    </type>
  </library>

I think the error is caused by these two lines:

<inventoryverbs type="list">Cast</inventoryverbs>
      <displayverbs type="list">Learn</displayverbs>

Should they be "stringlist"

Also, the game is not letting you 'learn' the spell, unless you change the object type as follows:

<library>
    <verb>
    <property>learn</property>
    <pattern>learn</pattern>
    <defaultexpression>"You can't learn " + object.article + "."</defaultexpression>
  </verb>
	<type name="spell">
      <drop type="boolean">false</drop>
      <take type="boolean">false</take>
      <usedefaultprefix type="boolean">false</usedefaultprefix>
      <learn type="script"><![CDATA[
        if (not this.parent = player) {
          this.parent = player
          msg ("In a process that seems at once unfathomable, and yet familiar, the spell fades away, and you realise you are now able to cast the <i>" + this.alias + "</i> spell.")
        }
        else {
          msg ("Er, you already know that one!")
        }
      ]]></learn>
    </type>
  </library>

The Pixie
26 Apr 2019, 07:26

That must be really old code. Back in Quest 5.0 you used "list" as the type for string lists; it got changed around 5.3 or 5.4, and for one version either was accepted. The verb I just forgot I guess! I have updated the docs, if you could take a look.


Doctor Agon
26 Apr 2019, 18:23

Ok, I've put those two lines into the library, no error messages now, however the 'fireball spell' is no longer highlighted 'hyperlinked'.


DarkLizerd
27 Apr 2019, 02:45

Check the spelling...
Even Little things can make a difference!


Doctor Agon
27 Apr 2019, 06:06

I guess DL is making some hint about the spelling:
I've tried "StringList", "Stringlist", "stringlist", "list", "List", even tried "stringList" on the off chance. Some of those produced the error message 'attribute type not recognised'


The Pixie
27 Apr 2019, 07:50

Try "simplestringlist"


Doctor Agon
27 Apr 2019, 08:32

That works now Pixie, it just says 'Learn'. Thanks.

Also just noticed something else

<mustnotinherit>editor_room; defaultplayer</mustnotinherit>

The tab doesn't appear on the 'room' object, but does appear on the 'player' object

This next bit of coding is from the 'NpcLib'

<!-- Items for NPCs -->
  <tab>
    <parent>_ObjectEditor</parent>
    <caption>Items for NPCs</caption>
    <mustnotinherit>editor_room; defaultplayer;NpcType</mustnotinherit>

Again, the tab doesn't appear on the 'room' object, but does appear on both the 'player' and 'NPC' object.

I thought it shouldn't appear on any of those.

Edit:
changed;

<mustnotinherit>editor_room; defaultplayer</mustnotinherit>

to

<mustnotinherit>editor_room; editor_player</mustnotinherit>

and that seems to stop the tab being displayed on the player object. What is the difference between 'defaultplayer' and 'editor_player'.

I've been playing around a bit and can get a tab on the room object <mustinherit>editor_room</mustinherit>, but I'm having trouble getting a tab on the 'game' object.


mrangel
28 Apr 2019, 11:58

The tab doesn't appear on the 'room' object, but does appear on the 'player' object

I think you want editor_player rather than defaultplayer.
If I'm understanding this code correctly, the defaultplayer type is only applied when the game actually starts, so isn't accessible in the editor.


Doctor Agon
28 Apr 2019, 19:42

Good to know. Thanks. I've looked at a few of Pixies libraries and she seems to use both.

Any idea on how to put a tab on the main 'game' object.


Doctor Agon
03 May 2019, 22:14

Still having trouble with this.

Is it possible to put a tab on the 'game' object.


Richard Headkid
03 May 2019, 23:38

I don't think you can do that without altering a file in the Quest directory in your Program Files directory.

Let me see if I am patient enough to wait for Windows 10 to boot up... If I can actually make it to a desktop, I'll test things out to make sure I'm remembering everything correctly and return with some solid information for you.


Richard Headkid
04 May 2019, 00:30

I was wrong. We don't need to alter any files to add tabs to the game object.

Just put _GameEditor as the parent, like so:

<tab>
    <parent>_GameEditor</parent>
    <caption>TEST TAB</caption>
</tab>

That just creates a blank tab, but it proves that it works.

Here's some info concerning tabs:
http://docs.textadventures.co.uk/quest/tabs_for_types.html

You can also peruse the code in files like: Quest/Core/CoreEditorGame.aslx.


And remember, kids:

Always create a library to add tabs! Never do it in code view, because Quest will ERASE any <tab> elements in the main source code each time you close Quest.

#TheMoreYouKnow


Dcoder
04 May 2019, 02:24

The more I know, the more I want to shoot myself.

#MayIsMentalHealthMonth


Dcoder
04 May 2019, 02:54

Richard Headkid
04 May 2019, 04:42

The more I know, the more I want to shoot myself.

The image in that post doesn't display.

I assume that I'd know you were joking if I could see that image...


Dcoder
04 May 2019, 05:20

Ok, removed the dead image. It's just the same image, but by the time I figured out how to post it, I kept getting the "You can't post that here" message.

Yeah, I guess dry sarcasm doesn't convey well in text :P


Richard Headkid
04 May 2019, 14:42

I guess dry sarcasm doesn't convey well in text

I thought I sensed it, but thought it would be wise to double check.

...and we all have problems when trying to pass off sarcasm via text. In fact, one of my favorite authors (Christopher Moore (aka @TheAuthorGuy)) began using a "sarcasm font" on Twitter to surmount the problem.

EXAMPLE:
<sarcasm font>I sure am glad we have a president who knows more about any given subject than anyone else!</sarcasm font>


Dcoder
04 May 2019, 15:30

<oxymoron><moron>Trump</moron>is the greatest President ever!</oxymoron>


Richard Headkid
05 May 2019, 16:37

Curses!

I told myself I'd stop referring to He Who Shall Not Be Named online.

Sorry to have sullied your thread, DrAgon.


Doctor Agon
05 May 2019, 16:51

No. It's fine, and quite amusing.

I did however put <moron>Trump</moron> into my first quest library, but nothing happened.
<sarcasticfont>Nothing new there</sarcasticfont>

Getting back to my thread though.
Is there a list of <xml> codes that are able to be used in the building of a library, tabs, etc...
Much in the same way as there is for Functions, Script commands, Attributes


0hardcore897
07 May 2019, 20:36

It's probably because trump is actually a moron. Complete moron.


Richard Headkid
08 May 2019, 00:13

Is there a list of <xml> codes that are able to be used in the building of a library, tabs, etc...

Mmm... Not that I know of. It's basically the same code you'd find in Code View, only wrapped in <library></library>.

The tabs are the only thing different as far as I know, and that link I posted earlier is the most extensive doc I've seen. (This is by default, because it's the only doc concerning tabs I've ever seen. Ha ha!)


It's probably because [He Who Shall Not Be Named] is actually a moron. Complete moron.

You wanna know something scary? He Who Shall Not Be Named isn't actually a moron. (Or, at least, he didn't used to be.)

Hold on, now... Hear me out. I am definitely not on the He Who Shall Not Be Named train. Listening to the man speak nowadays pains me.

...but He Who Shall Not Be Named used to have quite an extensive vocabulary. He also used to say things that made sense. I didn't usually agree with the things he said, but they did, at least, make sense.

Everything he says these days seems like it's just fuel for right-wing conspiracy theorists and/or to "trigger the libs".

That's the game, you see: Say something wildly and patently false. Then, when the other side reacts accordingly, play the victim.


Richard Headkid
13 Jun 2019, 00:11

Here is my old working example:

  <editor>
	<tab>
	  <parent>_GameEditor</parent>
	  <caption>Verbosity Settings</caption>
	  <appliesto>game</appliesto>
	  <control>
		<controltype>checkbox</controltype>
		<caption>Always print room descriptions</caption>
		<attribute>verboseonly</attribute>
	  </control>
	  <control>
		<onlydisplayif>not GetBoolean(game,"verboseonly")</onlydisplayif>
		<controltype>checkbox</controltype>
		<caption>Always print room descriptions when player enters LOOK</caption>
		<attribute>verboseonly</attribute>
	  </control>
	</tab>
  </editor>

(This is (of course) useless -- unless you're using my old library, but I thought someone might like to see complete, working code.)


Doctor Agon
13 Jun 2019, 20:29

Does <appliesto> work in much the same way as <mustinherit> or <mustnotinherit>.
Also, is it necessary to use <appliesto>game</appliesto>?
Would the fact that <parent>_GameEditor</parent> mean that it applied to the game anyway?

Sorry, I'm just trying to get my head around some of the coding and forms of codes or tags that are used.

I've noticed also that 'The Pixie' uses [...insert template name here...], which I presume makes it easier for the libraries to be translated into other languages.


The Pixie
14 Jun 2019, 07:38

Is there a list of

I have never found any documentation for this (besides what I wrote myself). Even delving into the C# source code has not been helpful at all. If anyone discovers anything about these things, let me know and I will add it to the docs!

Does

I realise I have no idea what appliesto actually does.

Would the fact that mean that it applied to the game anyway?

I would guess it means that this tab should be based on the _GameEditor tab (or more technically inherits from it), so I think the answer is no.

I've noticed also that 'The Pixie' uses [...insert template name here...], which I presume makes it easier for the libraries to be translated into other languages.

Yes, but... Because of the way Quest loads, you would need to have the language file for your library to load before the library itself, and frankly it is not worth the bother for a custom library (if there examples of where I have done that out there, they will date from before I realised how templates worked!).