Default message on library tab

I'm trying to create a library, adding a tab to an existing room and/or object, with a control box showing a default message.
I've set the tab up correctly, but I'm having trouble adding the default message.
Do I need to create a new type and have the message <mustinherit>or <inheritname>.
Any help is appreciated.


I am really struggling with this and not sure why it's not working:
I have the following code set up in a library

<library>

<!--
 Sets the dark room messages to a default setting
DarkMessage1, 2, 3
  -->
<!--
 DarkMessage2, 3: TBC
  -->

<type name="Dark2Type">
<inherit name="editor_room"/>
<DarkMessage1>You hear a scurrying noise in the distance.</DarkMessage1>
</type>

<!--
 Interface: Tab is only visible when room is dark
  -->

<tab>

<parent>_ObjectEditor</parent>
<caption>Dark+</caption>
<onlydisplayif>(GetBoolean (this, "dark"))</onlydisplayif>
<mustinherit>editor_room</mustinherit>
<mustnotinherit>editor_object; editor_player</mustnotinherit>

<control>
 
<controltype>textbox</controltype>
<caption>DarkMessage1</caption>
<attribute>DarkMessage1</attribute>
<mustinherit>Dark2Type</mustinherit>

</control>
	  
</tab>

</library>

Any help is appreciated.


I assume you've given an object the Dark2Type type to

How does it not work? Does it not show the control, or not show the default value?

(I would also suggest that your use of "mustinherit" and "mustnotinherit" looks likely to annoy users. You hide this tab for rooms which are also objects; which could be frustrating. You also hide the tab if the room isn't dark - making it harder to use your library for rooms whose darkness status changes during play)


I assume you've given an object the Dark2Type type to
Not sure how I go about giving it to the room, I assumed, probably incorrectly that if the light/darkness feature was selected for that room it would have that property.

How does it not work? Does it not show the control, or not show the default value?
No the tab is completely blank, which if it's not set to an object (see above) could be why.

You also hide the tab if the room isn't dark - making it harder to use your library for rooms whose darkness status changes during play)
I hadn't thought of that. At the moment the library is for my own game, and just playing around, making sure I know how 'types' and 'tabs' work.

If you can help set the type for the room/any room, I would be grateful.


OK… the "mustinherit" basically means that it's only displayed for objects which have a specific type. You need to set the type before that does anything meaningful.

So I think you want something like:

<library>
  <type name="Dark2Type">
    <DarkMessage1>You hear a scurrying noise in the distance.</DarkMessage1>
  </type>

  <tab>
    <parent>_ObjectEditor</parent>
    <caption>Dark+</caption>
    <mustnotinherit>editor_object</mustnotinherit>

    <control>
      <controltype>dropdowntypes</controltype>
      <caption>Use Dark+ type</caption>
      <types>*=No; Dark2Type=Is a Dark2Type</types>
      <width>150</width>
    </control>

    <!-- From your description, it sounds like this is a darkness-related type. So it makes sense to have a copy of the dark flag here -->
    <control>
      <caption>[EditorObjectLightDarkRoomisinitially]</caption>
      <controltype>checkbox</controltype>
      <attribute>dark</attribute>
    </control>

    <control>
      <controltype>textbox</controltype>
      <caption>DarkMessage1</caption>
      <attribute>DarkMessage1</attribute>
      <mustinherit>Dark2Type</mustinherit>
    </control>	  
  </tab>
</library>

Thanks mrangel, that's a great help.

I was thinking of assigning some sort of 'drop-down menu' to set the object. Is there a way of setting the 'instance of an object' from another tab. I mean, the light/darkness setting has already been checked from the 'features tab', as has the 'room initially dark' checkbox has been ticked. It just seems that you're doing the job twice.

I'm still learning, just need to get my head around these 'types' and 'tabs' and how they work.


The "initially dark" checkbox sets a room's dark attribute.
The checkbox on the features tab doesn't do anything to the game; it just shows the "Light/Darkness" tabs.

If your system and the built-in darkness system serve different needs (different types of darkness?) then it's not redundant.

If your library is supposed to replace the existing light/darkness system, then uncheck the default one on the features tab and put all the details you need on your own tab.

I was looking into doing a more sophisticated darkness system. My method would have been having multiple types:

<type name="darkroom">
  // other attribute defaults here
</type>

<type name="darkroomdark">
  <inherit name="darkroom" />
  <dark>true</dark>
</type>

  <tab>
    <parent>_ObjectEditor</parent>
    <caption>Darkness/Light</caption>

    <control>
      <controltype>dropdowntypes</controltype>
      <caption>Room darkness type</caption>
      <types>*=Disabled;darkroom=Initially light;darkroomdark=Initially dark</types>
      <width>150</width>
      <mustnotinherit>editor_object</mustnotinherit>
    </control>

    <control>
      <controltype>dropdowntypes</controltype>
      <caption>Object lightsource type</caption>
      <types>*=Not a light source;lighttype=Simple light source;lightswitchable=Switchable light source;lightdimmable=Dimmable light source</types>
      <width>150</width>
      <mustnotinherit>editor_room</mustnotinherit>
    </control>

  // and all the other attributes; showing those applicable based on the different room/lightsource types above

by having two types, with one of them making the room initially dark, it means there's only one dropdown that both enables the rest of the controls, sets the defaults, and decides if the room is initially dark.


Log in to post a reply.

Support

Forums