DMsGuild
Page 1 of 6 123 ... Last
  1. #1

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096

    ModulePlus Extension

    I began this work as a result of this thread over in the House of Healing area, and I thank Nickodemus and Trenloe for their assistance. I'm just getting started on this extension, but here's what I currently want to do with it:

    This extension addresses several issues with 3.5E and PFRPG module data. If a player uses manage characters to work on characters before and between games, this extension will take advantage of any modules the player may have. Specifically:

    1) When you drag module data onto the relevant fields of a character sheet or mini-sheet, the extension causes both the link to the source and the data itself to be copied into the database. This permits use of the information even when the module(s) is/are not loaded and also permits access to the original source material if the module is loaded.
    2) When a character sheet is opened or when a module is loaded or unloaded, the extension will see if necessary modules are loaded.
    a) If a module is loaded, any reference in a character sheet to that module will have a tooltip that suggests holding down the control key to access the data within the module itself rather than the copied data.
    b) If a module is not loaded, the tooltip will show the module that should be loaded if the user wants to get to the data source.
    3) For module data display, this extension adds a control to return to the parent window. Although this is probably not that useful if you navigate to the content through the library and its nested windows, it is vital if you get to the information from a character sheet, since the parent windows most likely wouldn't be open.
    4) For library module data that use the generic reference windows, there is now a description text block above all the referencelist data. Existing modules will, of course, not provide anything in this field, but they could be modified to provide the data.
    5) The character information that supports the features above are:
    race
    class(es)
    skills
    items
    weapons
    spells
    feats
    special abilities
    armor proficiencies
    weapon proficiencies

    EDIT: (Fixed file name to hopefully work automatically)
    Okay, here is version 0.1. I have not tested it in 3.5E, but since the code I'm extending is in that ruleset, it should work there as well as PFRPG, which is where I did my testing. All this currently does is take care of Nickademus' most pressing problem. That is, if you drag data from a module to the Abilities tab of your character sheet, this extension stores not only the link to that data but also the data itself. This is advantageous because the GM will not need to have the module loaded at game time in order to access the information.

    I have tested it with feats and with special abilities, but since I don't know the format of the data in the weapon and armor proficiencies (and where you might drag that from), I have not tested it for those areas of the character sheet. In theory, it should work.

    I'd sure appreciate it if someone can tell me what the format of that data is and what module you'd drag it from so I can test it more fully.

    ModulePlus.ext
    Last edited by Bidmaron; March 3rd, 2014 at 18:52. Reason: Release

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    29,675
    This will be a very useful extension.

    Do you plan on storing the data in the <charsheet> database record so that it will work fine if the GM does not have the extension loaded? Or will it require the extension to be loaded all the time to access the data?
    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!

  3. #3

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    I plan to do it so that it works without the extension, but of course none of the functionality will be there without it. I intend to implement so that it functions just like you manually typed it.

  4. #4

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    There doesn't appear to be any documentation on the shortcut database node, and searching the forum comes up with 17 pages of stuff related to everything except database nodes.

    It obviously has a type attribute (is anything but windowreference okay?).
    It has a class subnode, which is obvious what it does and is.
    It also has a recordname child. Apparently, if that is blank, it extracts the record information from the sibling nodes of the shortcut node, right?

  5. #5
    Zeus's Avatar
    Join Date
    Mar 2009
    Location
    Olympus
    Posts
    2,658
    Blog Entries
    2
    Here's what I tend to use:

    Code:
    <shortcut type="windowreference">
       <class>name of windowclass</class>
       <recordname>fully qualified database node path</recordname>
    </shortcut>
    I don't define a type attribute for class or recordname. If recordname is blank then I assume it will use the database path of the parent node the shortcut belongs to.
    FG Project Development
    Next Project(s)*: Starfinder v1.2 Starship Combat

    Current Project:
    Starfinder v1.1 - Character Starships
    Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
    * All fluid by nature and therefore subject to change.

  6. #6

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Yeah, that's what I've seen. I was just hoping there was some official documentation somewhere I was missing, as this node type seems to be intrinsic to FG and not manipulated by rulesets or extensions (well, what I mean is that you obviously create these in your ruleset or extension, but your window class code doesn't have to do anything with it, as FG populates the window class with the nodes from the record name (or, apparently, if the record name is blank, the nodes in the siblings to shortcut).

  7. #7
    Zeus's Avatar
    Join Date
    Mar 2009
    Location
    Olympus
    Posts
    2,658
    Blog Entries
    2
    Here's the documentation from the Library for windowreferencecontrol, you can see you can define a relative path (window) for the recordname

    <class > The name of the window class used for an opened window instance
    <recordname > ... </recordname> A relative (to the window data source) database identifier pointing to the data source to assign to the opened window
    </class>
    FG Project Development
    Next Project(s)*: Starfinder v1.2 Starship Combat

    Current Project:
    Starfinder v1.1 - Character Starships
    Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
    * All fluid by nature and therefore subject to change.

  8. #8

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Thanks, Zeus. I guess I should have known to check that class.

  9. #9

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096

    First Code Question

    Okay, I'm sure I'm going to feel stupid when I see the answer, but I am seeing the following error when I start up FG with my extension loaded:
    Console window:
    Runtime Notice: Reloading ruleset
    Script Error: [string "charsheet_abilities:feats"]:1: 'end' expected near '<eof>'
    Script Error: [string "charsheet_abilities:specialabilities"]:1: 'end' expected near '<eof>'
    Script Error: [string "charsheet_abilities:armorprofs"]:1: 'end' expected near '<eof>'
    Script Error: [string "charsheet_abilities:weaponprofs"]:1: 'end' expected near '<eof>'
    Here is my Extension.xml file. I already tested the lua file by commenting it out to make sure that wasn't the problem, so I know it is in my xml file:

    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    
    <root version="3.0">
    	<properties>
    		<name>ModulePlus</name>
    		<version>0.1</version>
    		
    		<author>Charles Sykora (Bidmaron) with help from Trenloe and Nickademus</author>
    		<description>A plugin to improve use of modules</description>
    		
    		<ruleset>
    			<name>3.5E</name>
    		</ruleset>
    		<ruleset>
    			<name>PFRPG</name>
    		</ruleset>		
    	</properties>
    
    	<base>
     	<template name="list_charabilities">
    		<list_text>
    			<anchored>
    				<top offset="35" />
    				<left offset="15" />
    				<right offset="-15" />
    				<bottom offset="-15" />
    			</anchored>
    			<sortby><control>value</control></sortby>
    			<newfocus>value</newfocus>
    			<script>
    				function onDrop(x, y, draginfo)
    
     					if isReadOnly() then
    						return false;
    					end
    					
    					local winLevel = getWindowAt(x, y);
    					if not winLevel then
    						return false;
    					end
    <!-- 
    					-- Draggable spell name to move spells
    					if draginfo.isType("shortcut") then
    						local sDropClass, sSource = draginfo.getShortcutData();
    						-- Module ability information
    						if sDropClass == "referencefeat" then
    							local nodeSource = DB.findNode(sSource);
    							local nodeAbilityList = nil;
    							
    							-- Create the new ability entry
    							local nodeNewAbility = nodeAbilityList.createChild();
    							if not nodeNewAbility then
    								return nil;
    							end
    							
    							-- Build the list details
    							win.value.setValue(DB.getValue(nodeSource, "name", ""));
    							win.shortcut.setValue(draginfo.getShortcutData());
    							DB.setValue(nodeNewAbility,"storelink","string",win.shortcut.recordname.getValue());
    							win.shortcut.recordname.setValue("");
    							return true;
    						end
    					end
    				 -->
    				 end
    			</script>
     		
    		</list_text>
    	</template>
    
     		<script name="ModPlusExtStart" file="extension_start.lua"/>		
    	
    	</base>
    </root>
    As you can see, I have most of the code commented out and am still getting the error. I am attempting to override the list_charabilities template to implement the new functionality.

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    29,675
    Quote Originally Posted by Bidmaron View Post
    Okay, I'm sure I'm going to feel stupid when I see the answer, but I am seeing the following error when I start up FG with my extension loaded:
    Remove the whole section that you have commented.

    Comments work differently in scripts in XML.

    See the "Using Scripts" section here: https://www.fantasygrounds.com/modguide/scripting.xcp
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Fantasy Grounds Fridays Pre

Log in

Log in