Starfinder Playlist
  1. #1

    Extensions and Database nodes

    I'm having a doosy of a time trying to figure out how the extension database works.

    I can't seem to get 'getDatabaseNode()' to ever return anything other than a nil value. The extension guide says "Value nodes are created automatically when a window containing value field controls is opened. They can also be created using the scripting interface. Each value node has a specific type."

    I assume this means that databasenodes are tied to the window whenever a window with certain controls are rendered. It doesn't seem to be working for me and I've no idea what I'm doing wrong.

    For reference, here's the entirety of a settings windowclass for an extension I'm writing. The onInit method prints 'nil' for getDatabaseNode();

    Code:
    		<windowclass name="combat_timer_settings">
    			<margins control="0,0,0,0" />
    			<frame name="groupbox" offset="15,15,20,15" />
    			<placement>
    				<size width="275" height="300" />
    				<nosave />
    			</placement>
    			<datasource>.settings</datasource>
    			<script>
    				function onInit()
    					Debug.console("onInit - combat_timer_settings", getDatabaseNode());
    				end
    				
    				function onClose()
    					Debug.console("onClose - combat_timer_settings");
    				end
    			</script>
    			<sheetdata>
    				<settings_title name="title" />
    				<anchor_timer_settings name="contentanchor" />
    				<label name="label_timer_type">
    					<anchored to="contentanchor" height="20">
    						<top anchor="bottom" relation="relative" offset="10" />
    						<left offset="0" />
    						<right offset="-80" />
    					</anchored>
    					<static text="Timer Type" />
    				</label>
    				
    				<button_stringcycler name="timer_type">
    					<anchored>
    						<top parent="label_timer_type" offset="0" />
    						<bottom parent="label_timer_type" offset="0" />
    						<left parent="label_timer_type" anchor="right" offset="0" />
    						<right parent="contentanchor" offset="0" />
    					</anchored>
    				</button_stringcycler>
    				
    				<label name="label_timer_start">
    					<anchored to="contentanchor" height="20">
    						<top parent="label_timer_type" anchor="bottom" relation="relative" offset="10" />
    						<left offset="0" />
    						<right offset="-80" />
    					</anchored>
    					<static text="Initial Timer Value" />
    				</label>
    				
    				<numbercontrol name="timer_start">
    					<frame name="tokennumber" offset="0,0,0,0" />
    					<anchored width="30">
    						<top parent="label_timer_start" offset="0" />
    						<bottom parent="label_timer_start" offset="0" />
    						<left parent="label_timer_start" anchor="right" offset="0" />
    					</anchored>
    					<default>60</default>
    					<min>0</min>
    					<max>5999</max>
    				</numbercontrol>
    			
    				<label name="label_report_times">
    					<anchored to="contentanchor" height="20">
    						<top parent="label_timer_start" anchor="bottom" relation="relative" offset="10" />
    						<left offset="0" />
    						<right offset="-80" />
    					</anchored>
    					<static text="Summarize  Turns" />
    				</label>
    				
    				<button_checkbox name="report_player_times">
    					<anchored to="contentanchor" width="10">
    						<top parent="label_report_times" offset="0" />
    						<bottom parent="label_report_times" offset="0" />
    						<left parent="label_report_times" anchor="right" offset="0" />
    					</anchored>
    				</button_checkbox>
     
    				<close_timer_settings />
    				</sheetdata>
    			<invisible />
    		</windowclass>

  2. #2

  3. #3
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,654
    Blog Entries
    1
    Hey Ken L I would grab that code above and look for its final version in mortgarras Combat Timer extension.
    The database will accept pretty much anything you tell it...

  4. #4
    Quote Originally Posted by Ken L View Post
    bump for clarification
    I think I figured out the problem (though I haven't fully verified it). You need to explicitly create a window with a named datasource to get the DB node associated with it. I believe Interface.openWindow will do the trick.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in