BookLib, problems with inventory order when adding pages later?

Long story short:
My main character has a diary. When major changes happens within the game he automatically writes in it and a page is added to it. It's working and all... only problem is that it won't show up in the inventory in the right order. (see screenshot)
It sort of bugs me.

Here, page 7 was just added... and it looks like this...

Any idea what I need to do to make it show up in the correct order?


Can you show the code?
I can't find BookLib anywhere.


@mra

Click here for BookLib code
<?xml version="1.0"?>
<library>

  <type name="booktype">
    <inherit name="editor_object" />
    <inherit name="openable" />
    <take />
    <feature_container />
    <read type="script"><![CDATA[
      if (not this.parent = game.pov) {
        msg ("You are not holding it.")
      }
      else {
        if (not this.isopen) {
          msg ("It isn't open.")
        }
        else {
          if (ListCount(GetDirectChildren(this))>0) {
            ShowMenu ("Which page?", GetDirectChildren(this), true) {
              obj = GetObject(result)
              do(obj,"look")
            }
          }
          else {
            msg ("There are no pages.")
          }
        }
      }
    ]]></read>
      <inventoryverbs type="stringlist">
        <value>Look at</value>
        <value>Read</value>
        <value>Drop</value>
      </inventoryverbs>
  </type>
  <type name="pagetype">
    <inherit name="editor_object" />
    <displayverbs type="stringlist">
      <value>Read</value>
    </displayverbs>
    <inventoryverbs type="stringlist">
      <value>Read</value>
	  <value>Turn</value>
    </inventoryverbs>
    <read type="script">
	  if ((this.parent = game.pov) or this.parent.parent = game.pov){
        msg (this.pagetext)
	    if (HasAttribute(this,"nextpage")) {
		  msg ("{command:read "+GetDisplayAlias(this.nextpage)+":Next Page}")
	    }
	  }
	  else {
	    msg ("You have to be holding something to read it.")
	  }
    </read>
	<look type="script"><![CDATA[
	  do (this, "read")
	]]></look>
	<pagetext type="string"><![CDATA[This page intentionally left blank.<br/>]]></pagetext>
    <turn type="script">
	  exists = false
	  if (HasAttribute(this,"nextpage")){
        if (this.nextpage.parent = this.parent){
		  if (this.nextpage.visible){
		    do(this.nextpage,"read")
			exists = true
		  }
		}
	  }
	  if (not exists){
	    msg ("There is no page following this one.")
	  }
    </turn>
  </type>
  
<!-- Interface -->
  <tab>
    <parent>_ObjectEditor</parent>
    <caption>Book Options</caption>
    <mustnotinherit>editor_room; defaultplayer</mustnotinherit>

    <control>
      <controltype>dropdowntypes</controltype>
      <caption>Type</caption>
      <types>*=None; booktype=Book; pagetype=Page</types>
      <width>150</width>
    </control>
	
	<control>
	  <onlydisplayif>DoesInherit(this,"pagetype")</onlydisplayif>
	  <controltype>checkbox</controltype>
	  <caption>Has next page</caption>
	  <attribute>hasnextpage</attribute>
	</control>
	
	<control>
	  <onlydisplayif>DoesInherit(this,"pagetype") and GetBoolean(this,"hasnextpage")</onlydisplayif>
	  <controltype>objects</controltype>
	  <caption>Next page</caption>
	  <attribute>nextpage</attribute>
	</control>
	
	<!--
	
	<control>
	  <onlydisplayif>DoesInherit(this,"pagetype")</onlydisplayif>
	  <controltype>checkbox</controltype>
	  <caption>Has previous page</caption>
	  <attribute>haspreviouspage</attribute>
	</control>
	
	<control>
	  <onlydisplayif>DoesInherit(this,"pagetype") and GetBoolean(this,"haspreviouspage")</onlydisplayif>
	  <controltype>objects</controltype>
	  <caption>Previous page</caption>
	  <attribute>previouspage</attribute>
	</control>
	-->
	
	<control>
	  <onlydisplayif>DoesInherit(this,"pagetype")</onlydisplayif>
	  <controltype>richtext</controltype>
	  <caption>Page text (Same as 'look' attribute.  This displays when reading or examining the page.)</caption>
	  <attribute>pagetext</attribute>
	</control>
	  


  </tab>
  
	
</library>




When adding a page to it afterwards I do MoveObject(pagename, diary), pagename.hasnextpage=true and pagename.nextpage = pagenumber.


Ah; the page objects are all created in the editor, rather than created during play?
In that case, they should appear in the inventory in the same order they are in the editor.

If you can acquire the pages in different orders, and want them to appear in the order you gained them, then I think you can do that by cloning pages into the diary instead of moving them.


Ah, so simple!
Thanks man!!!
(I just changed the order of the objects in the editor and yes... it's working now)


Log in to post a reply.

Support

Forums