STAR TREK 2d20
Page 1 of 2 12 Last

Thread: Error with iadd

  1. #1
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1

    Error with iadd

    Hi team,

    I have added a new campaign tool called CAS (Command Line Attributes and Skills) for MoreCore. It will allow you to have a library of drag n drop skills / attributes / rolls for use with systems being played on top of MoreCore. Im totally fudging my way thru here but I have the button, the window, the list of skills. I can right click in the window and add a new CAS entry but when I use the iadd button I get an error:

    Script Error: [string "campaign/cas_button_new.lua"]:8: attempt to index a nil value

    Attachment 14133

    I took code from campaign_button_new.lua and template_campaign.xml.

    iadd button xml
    Code:
    	<template name="button_iadd_cas">
    		<button_iadd_campaign>
    			<script file="campaign/cas_button_new.lua" />
    		</button_iadd_campaign>
    	</template>
    cas_button_new.lua
    Code:
    -- 
    -- Please see the license.html file included with this distribution for 
    -- attribution and copyright information.
    --
    
    function onButtonPress()
    	if User.isHost() then
    		local node = window.getDatabaseNode().createChild();
    		if node then
    			local w = Interface.openWindow(class[1], node.getNodeName());
    			if w and w.name then
    				w.name.setFocus();
    			end
    		end
    	else
    		local nodeWin = window.getDatabaseNode();
    		if nodeWin then
    			Interface.requestNewClientWindow(class[1], nodeWin.getNodeName());
    		end
    	end
    	
    	window.list_iedit.setValue(0);
    end
    I believe that the window.getDatabaseNode() is not getting a value and this is the cause of the error... but I cant see why this is happening...

    Line 8 is:
    local node = window.getDatabaseNode().createChild();

    Any suggestions?
    Happy to post a dropbox link to the whole ruleset...

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1
    Not an answer to my question above but I just added the ability to export these rolls to a module as part of the inbuilt /export command/utility.
    I probably need to change the window to use campaignlistwithtabs instead of the current one but that will have to come later.

    Attachment 14135

    But in other news - I still need help with the iadd button if anyone has any ideas...

  3. #3

  4. #4
    Zacchaeus's Avatar
    Join Date
    Dec 2014
    Location
    Scotland
    Posts
    20,904
    I think you'll need a Moon Wizard
    If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php

  5. #5
    Hi Chap,

    Just fired an email off. If you're struggling - chuck me the ruleset and when I finish being 'Dad' for this afternoon, I'll take a butchers.

    Cheers
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1
    As I get a Nil result on the window.getDatabaseNode() I think my issue is happening earlier.
    Going back to the campaign_cas.xml (new) file where the cas_button_new.lua is being called from Im pretty sure that it wasnt getting the getDatabaseNode() there either as I have specified it manually to get it to work... <datasource>clilist</datasource>

    campaign_cas.xml
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <!-- 
      Please see the license.html file included with this distribution for 
      attribution and copyright information.
    -->
    
    <root>
    
    	<template name="button_iadd_cas">
    		<button_iadd_campaign>
    			<script file="campaign/cas_button_new.lua" />
    		</button_iadd_campaign>
    	</template>
    	
    	<windowclass name="cassmall">
    		<margins control="0,0,0,2" />
    		<!-- come back and fix!!! <script file="campaign/scripts/campaign_list_record.lua" /> -->
    		<sheetdata>
    
    			<!-- Create Left Anchor -->
    			<genericcontrol name="leftanchor">
    				<anchored height="0" width="0">
    					<top offset="2" />
    					<left />
    				</anchored>
    			</genericcontrol>
    
    			<!-- Create Right Anchor -->
    			<genericcontrol name="rightanchor">
    				<anchored height="0" width="0">
    					<top offset="2" />
    					<right />
    				</anchored>
    			</genericcontrol>
    
    			<!-- Add Shortcut Button for use with Libraries or to store info -->
    			<linkfield name="shortcut">
    				<anchored to="leftanchor" width="20" height="20">
    					<top />
    					<left anchor="right" relation="relative" offset="4" />
    				</anchored>
    				<class>ref_attributes</class>
    				<description field="name" />
    				<readonly />
    			</linkfield>
    
    			<!-- Create Field to hold the Roll Info -->
    			<simplestring name="name">
    				<readonly />
    				<anchored position="insidetopleft" offset="0,0" height="20">
    					<left parent="leftanchor" anchor="right" relation="relative" offset="8" />
    				</anchored>
    				<script>
    					function onEnter()
    						return true;
    					end
    					function onDeleteUp()
    						if isReadOnly() then
    							return;
    						end
    					end
    				</script>
    			</simplestring>
    
    			<button_idelete name="idelete">
    				<anchored>
    					<top />
    					<right parent="rightanchor" anchor="left" relation="relative" offset="-2" />
    				</anchored>
    			</button_idelete>
    
    		</sheetdata>
    	</windowclass>
    	
    	<windowclass name="caslist">
    		<frame>campaignlistwithtabs</frame>
    		<placement>
    			<size width="300" height="400" />
    		</placement>
    		<sizelimits>
    			<minimum width="300" height="400" />
    			<dynamic />
    		</sizelimits>
    		<softclose />
    		<nodelete />
    		<sheetdata>
    			<banner_campaign>
    				<icon>title_cas</icon>
    			</banner_campaign>
    
    			<list_campaign_nofilter name="list">
    				<datasource>clilist</datasource>
    				<class>cassmall</class>
    				<script>
    					function onDrop(x, y, draginfo)
    						if draginfo.isType("shortcut") then
    							return CampaignDataManager.handleDrop("cassmall", draginfo);
    						end
    					end
    				</script>
    			</list_campaign_nofilter>
    			<scrollbar_list />
    
    			<anchor_campaign_nofilter />
    			<button_iedit_campaign>
    				<script>
    					function onInit()
    						setVisible(true);
    					end
    				</script>
    			</button_iedit_campaign>
    			<button_iadd_cas>
    				<class>cassmall</class>
    			</button_iadd_cas>
    
    			<categories>
    				<targetcontrol>list</targetcontrol>
    			</categories>
    
    			<resize_campaignlistwithtabs />
    			<close_campaignlist />
    		</sheetdata>
    	</windowclass>
    </root>
    So Ive messed up something further back... hrmmmm....
    Last edited by damned; May 22nd, 2016 at 14:13.

  7. #7
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,693
    Blog Entries
    1
    Ok a bit more info for anyone that may look at this while I sleep...

    I added the db node clilist in desktop.lua using:

    Code:
    function registerPublicNodes()
    	if User.isHost() then
    		DB.createNode("options").setPublic(true);
    		DB.createNode("partysheet").setPublic(true);
    		DB.createNode("calendar").setPublic(true);
    		DB.createNode("combattracker").setPublic(true);
    		DB.createNode("modifiers").setPublic(true);
    		DB.createNode("effects").setPublic(true);
    		DB.createNode("clilist").setPublic(true);
    	end
    end
    I added the campaign tool button in desktop.lua using:
    Code:
    		DesktopManager.registerStackShortcut2("button_cas", "button_cas_down", "sidebar_tooltip_cas", "caslist");
    Created the file campaign_cas.xml with the following templates and windowclasses
    <template name="button_iadd_cas">
    <windowclass name="cassmall">
    <windowclass name="caslist">

    And from there on we go back up to the posts at the start of this thread.

    Ruleset is here: https://www.dropbox.com/s/yovjrz7c68...eCore.pak?dl=0
    Basic, basic dataset here: https://www.dropbox.com/s/gmccywjsrf...leset.zip?dl=0

    How to recreate error:
    Create a new MoreCore campaign or use MoreCoreRuleset campain.
    Open console (/console)
    Open CAS from Campaign Tools
    Click Edit button and then Add
    You will see the Nil result from Debug.console and the resultant FG error message.

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,442
    Quote Originally Posted by damned View Post
    I added the campaign tool button in desktop.lua using:
    Code:
    		DesktopManager.registerStackShortcut2("button_cas", "button_cas_down", "sidebar_tooltip_cas", "caslist");
    You're missing the final parameter that specifies the databasenode to tie the "caslist" windowclass to. Use:

    Code:
    DesktopManager.registerStackShortcut2("button_cas", "button_cas_down", "sidebar_tooltip_cas", "caslist", "clilist");
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  9. #9
    Quote Originally Posted by Trenloe View Post
    You're missing the final parameter that specifies the databasenode to tie the "caslist" windowclass to. Use:

    Code:
    DesktopManager.registerStackShortcut2("button_cas", "button_cas_down", "sidebar_tooltip_cas", "caslist", "clilist");
    Hi Chap,

    Does that fix his issue? As I'm almost done being Dad today (ie the kids can watch the TV now) so I can take a look.

    Cheers
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,442
    Quote Originally Posted by MadBeardMan View Post
    Does that fix his issue?
    It's fixes this issue, yeah.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

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
  •  
Starfinder Playlist

Log in

Log in