PDA

View Full Version : ModulePlus Extension



Bidmaron
February 27th, 2014, 20:30
I began this work as a result of this thread (https://www.fantasygrounds.com/forums/showthread.php?20483-Module-Access) 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.

6192

Trenloe
February 27th, 2014, 20:39
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?

Bidmaron
February 27th, 2014, 21:41
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.

Bidmaron
March 1st, 2014, 14:43
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?

Zeus
March 1st, 2014, 14:59
Here's what I tend to use:


<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.

Bidmaron
March 1st, 2014, 15:15
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).

Zeus
March 1st, 2014, 15:40
Here's the documentation from the Library for windowreferencecontrol, you can see you can define a relative path (window) for the recordname


https://www.fantasygrounds.com/images/blank.gif <class >The name of the window class used for an opened window instancehttps://www.fantasygrounds.com/images/blank.gif <recordname > ... </recordname>A relative (to the window data source) database identifier pointing to the data source to assign to the opened windowhttps://www.fantasygrounds.com/images/blank.gif </class>

Bidmaron
March 1st, 2014, 19:34
Thanks, Zeus. I guess I should have known to check that class.

Bidmaron
March 1st, 2014, 20:38
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:


<?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.

Trenloe
March 1st, 2014, 20:44
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

Bidmaron
March 1st, 2014, 20:46
Well, if I uncomment the section, I still get the error, so something is goobered up. I'll play with it and let you know once I isolate the problem.

Trenloe
March 1st, 2014, 21:01
Well, if I uncomment the section, I still get the error, so something is goobered up. I'll play with it and let you know once I isolate the problem.
You've removed the LUA comment "-- Draggable spell name to move spells" and the XML comment tags: <!-- --> ??

EDIT: And remove all of the other LUA comment lines starting with "--"

Bidmaron
March 1st, 2014, 22:03
Thanks, Trenloe. I've done that. Now just have to get code working.

Bidmaron
March 2nd, 2014, 14:06
Nickademus, I'm almost ready for you to give 0.1 a fling, but a couple of questions:
1) Where do you drag your weapon and armor proficiencies from, as I'd like to test that before I send it your way?
2) The process for character editing: how does the DM 'export' your character back to you so you can edit it?

Trenloe
March 2nd, 2014, 14:10
2) The process for character editing: how does the DM 'export' your character back to you so you can edit it?
Enter edit mode (click the brown / button) in Character Selection and then press the blue down arrow button to export a character.

Bidmaron
March 2nd, 2014, 14:11
Zeus, on the other thread you were complaining about bloat due to data duplication. A couple of thoughts and questions:

1) Does anyone know the logic by which 3.5E and PFRPG currently link to special abilities, weapon proficiencies, armor proficiencies, and feats but copies spells, weapons, armor and items? I ask because this seems to be the LEAST space-efficient manner to do anything. Spells should not be copied, as Clerics would theoretically have to duplicate the entire spell library, since they have access to them all. Keeping the spells module open is more space efficient.
2) Everything else, on the other hand, should be data copies, unless they are edited, in which case the data should be there. Zeus, it seems more data efficient for six characters to duplicate the information on feats and items than keeping these modules open during a game. Why would you link to data that is only a tiny fraction of the whole module?

Trenloe
March 2nd, 2014, 14:24
Zeus, on the other thread you were complaining about bloat due to data duplication. A couple of thoughts and questions:

1) Does anyone know the logic by which 3.5E and PFRPG currently link to special abilities, weapon proficiencies, armor proficiencies, and feats but copies spells, weapons, armor and items? I ask because this seems to be the LEAST space-efficient manner to do anything. Spells should not be copied, as Clerics would theoretically have to duplicate the entire spell library, since they have access to them all. Keeping the spells module open is more space efficient.
2) Everything else, on the other hand, should be data copies, unless they are edited, in which case the data should be there. Zeus, it seems more data efficient for six characters to duplicate the information on feats and items than keeping these modules open during a game. Why would you link to data that is only a tiny fraction of the whole module?
Copying "stuff" allows it to be edited - so think of them as templates being added to the character sheet to allow adjustments by the GM or Players.

As you point out, abilities will take up less space then spells and inventory items; so I doubt it is a concious decision based off trying to keep the <charsheet> record size down. I would imagine it is more than likely just because that was the way it was done originally and no one has asked for it to be changed until now.

There are arguments for both - modules are usually not just an "open when I want to drag something to my character sheet" option, they are library references so that people can check them out during a game, not just limited to character creation. Also, as has been pointed out, using links to libraries allows version updates to be automatically populated to any character sheet/link anywhere the campaign - very handy in an ongoing sandbox campaign where the GM might be modifying data/info as the game goes on.

As I say - some people like the links, some people don't.

Keep in mind that at the moment there is the best of both worlds available - a player can drag a link if they want to use the link and keep it updated with future module changes (but this does cause issues if the GM does not have that module), but if the player wants something specific to their character that they know the GM won't have then they can copy/paste the info. It is easy to copy/paste as it is just a single text field - other areas that are copied (spells and equipment for example) use multiple fields and so it is a bit of a pain to copy/paste from/to multiple fields.

Bidmaron
March 2nd, 2014, 14:49
Copying "stuff" allows it to be edited - so think of them as templates being added to the character sheet to allow adjustments by the GM or Players.

Right, I understand that, but what I'm doing is preserving both, so that if you were, say, doing character maintenance (on an exported copy) as a player, you could link back to the original if you load the module. In fact, if I wanted to get fancy, I could add a 'modified/edited' icon so you could see which were original entries and which had been edited.


As you point out, abilities will take up less space then spells and inventory items; so I doubt it is a concious decision based off trying to keep the <charsheet> record size down. I would imagine it is more than likely just because that was the way it was done originally and no one has asked for it to be changed until now.

There are arguments for both - modules are usually not just an "open when I want to drag something to my character sheet" option, they are library references so that people can check them out during a game, not just limited to character creation. Also, as has been pointed out, using links to libraries allows version updates to be automatically populated to any character sheet/link anywhere the campaign - very handy in an ongoing sandbox campaign where the GM might be modifying data/info as the game goes on.

Trenloe, I don't think many library modules are consulted during the game if you've built your adventure module properly. Keeping them closed saves memory, and you can always open them (and recluse them) to check something if you really need to do so. How many times have you actually had to go look at the feats listing in game?(e.g.)


As I say - some people like the links, some people don't.

Keep in mind that at the moment there is the best of both worlds available - a player can drag a link if they want to use the link and keep it updated with future module changes (but this does cause issues if the GM does not have that module), but if the player wants something specific to their character that they know the GM won't have then they can copy/paste the info. It is easy to copy/paste as it is just a single text field - other areas that are copied (spells and equipment for example) use multiple fields and so it is a bit of a pain to copy/paste from/to multiple fields.

Nickademus says copy and paste no longer works since JPG disabled the ability to edit modules in 3.0 (still don't understand why he did that). That's part of his beef if you go read his 'House of Healing' thread entry (https://www.fantasygrounds.com/forums/showthread.php?20483-Module-Access) post #31.

Moon Wizard
March 2nd, 2014, 18:02
Module editing was re-enabled in v3.0.1.

JPG

Trenloe
March 2nd, 2014, 18:52
Right, I understand that, but what I'm doing is preserving both, so that if you were, say, doing character maintenance (on an exported copy) as a player, you could link back to the original if you load the module. In fact, if I wanted to get fancy, I could add a 'modified/edited' icon so you could see which were original entries and which had been edited.
I also understand what you're trying to do, I wasn't questioning what you are trying to do I was simply answering your question of "Does anyone know the logic by which 3.5E and PFRPG currently link to special abilities, weapon proficiencies, armor proficiencies, and feats but copies spells, weapons, armor and items?"


Trenloe, I don't think many library modules are consulted during the game if you've built your adventure module properly. Keeping them closed saves memory, and you can always open them (and recluse them) to check something if you really need to do so. How many times have you actually had to go look at the feats listing in game?(e.g.)
I was referring to modules in general - there are many modules out there that have more than just a feat list. Nickademus's excellent class and races modules for example that could be frequently referred to during play, especially by the GM for NPCs.

There is also the PFRPG Basic Rules module that has feats, but also a whole lot more that can need to be referenced during play - both by players and GMs. Yes, a of of this information is not dragged to a character sheet, but some of it is and so the module might be kept open.

Other rulesets: C&C, RMC, CoC, etc. have very good ruleset reference modules as well - which would be kept open during play.

Hence I'm confused by your statement "I don't think many library modules are consulted during the game if you've built your adventure module properly." Or, perhaps I'm the only Fantasy Grounds GM who makes extensive use of library modules.


Nickademus says copy and paste no longer works since JPG disabled the ability to edit modules in 3.0 (still don't understand why he did that). That's part of his beef if you go read his 'House of Healing' thread entry (https://www.fantasygrounds.com/forums/showthread.php?20483-Module-Access) post #31.
I have read that thread thanks, I've even posted in it once or twice and Nickademus even mentiond "Trenloe knows what I'm talking about." - so I'm kinda up to speed about what we are talking about. :)

The editing modules issue that was disabled in FG 3.0 is different from copy/paste from a formatted text field - which is the main beef when Nickademus mentions "The text of a module entry, or at least the reference windows that I've seen, doesn't allow highlighting and thus copying. " As Moon Wizard mentions, module editing (i.e. being able to edit module story, NPC, etc. data) has been re-enabled - but not library entries, you could never edit th. The specific issue that Nickademus and others have mentioned is that you can't highlight text in a read-only formattedtext field and so you can't copy/paste from a library module into an ability, for example. My reply was not saying "Copy/paste the info from a module", it was just copy/paste in general - from the PRD, for example.

In the end, you're doing the work to create an extension - it is entirely up to you how you do that. I have just been spending time answering your questions, giving you feedback regarding FG background, how people would use things differently, pros and cons of things etc., because if you spend a lot of time creating something for the community it is good if the majority of the community get a lot of use from it. But, hey, your doing it so do it how you want... :)

Bidmaron
March 2nd, 2014, 19:12
Hey, Trenloe, I appreciate it very much. I didn't intend to sound ungracious. Thanks for your time. I'd like to make this as useful as possible to the most folks, so I appreciate your feedback.

Zeus
March 2nd, 2014, 23:39
Zeus, on the other thread you were complaining about bloat due to data duplication. A couple of thoughts and questions:1) Does anyone know the logic by which 3.5E and PFRPG currently link to special abilities, weapon proficiencies, armor proficiencies, and feats but copies spells, weapons, armor and items? I ask because this seems to be the LEAST space-efficient manner to do anything. Spells should not be copied, as Clerics would theoretically have to duplicate the entire spell library, since they have access to them all. Keeping the spells module open is more space efficient. 2) Everything else, on the other hand, should be data copies, unless they are edited, in which case the data should be there. Zeus, it seems more data efficient for six characters to duplicate the information on feats and items than keeping these modules open during a game. Why would you link to data that is only a tiny fraction of the whole module?

I think Trenloe has answered question 1 so I will focus on question 2. I think it really depends upon how you structure your module data. I see many variations throughout these forums; for example:

Some users opt to mirror rule and sourcebooks e.g. Tenian (see 4E forums and posts on his work on his 4EParser I think in the end his Parser supported 99% of all available 4E content)
Some users create highly focused modules; i.e. modules containing only current linked items, spells, feats, etc. etc for PC sheets.
Some users opt to create consolidated modules i.e. module of all PC Spells, NPC Bestiary

Bidmaron
March 3rd, 2014, 00:13
Thanks, Zeus. I'm currently at an impasse on the extension. In order to get it to do what needs to be done, I need to be able to set the class of the shortcut to the value "referencefeat" (for the part I'm working on now anyway). Here is the way the special abilities section of my campaign database looks right now:


<specialabilitylist>
<id-00001>
<shortcut type="windowreference">
<class>referencefeat</class>
<recordname>reference.alchemist.throwanything@PFRPG Classes</recordname>
</shortcut>
<value type="string">Toss Anything (Ex)</value>
</id-00001>
<id-00002>
<description type="string">A bogus ability.</description>
<locked type="number">0</locked>
<shortcut type="windowreference">
<class>ref_ability</class>
<recordname></recordname>
</shortcut>
<value type="string">Bogosity</value>
</id-00002>
<id-00003>
<benefit type="formattedtext">
<p>At 2nd level, an alchemist gains a +2 bonus on all saving throws against poison. This bonus increases to +4 at 5th level, and then again to +6 at 8th level. At 10th level, an alchemist becomes completely immune to poison.</p>
</benefit>
<locked type="number">0</locked>
<mult type="number">0</mult>
<name type="string">Poison Resistance (Ex)</name>
<normal type="formattedtext">
<p></p>
</normal>
<recordname>
</recordname>
<shortcut type="windowreference">
<class>referencefeat</class>
<recordname></recordname>
</shortcut>
<special type="formattedtext">
<p></p>
</special>
<stack type="number">0</stack>
<type type="string">Class</type>
<value type="string">Poison Resistance (Ex)</value>
</id-00003>
</specialabilitylist>


The first item in the list (id-00001) is an entry I manually added to the special abilities list of the PFRPG character sheet for a new character. As you can see, it links to a ref_ability window class when you click its link.

The second item in the list (id-00002) is an entry I edited in the database directly to simulate what I want to end up with for the sake of testing. If you click the link on that item, the data will open in the referencefeat window class just as if it had been linked from the library module. The difference is that you don't need to have the module loaded to see it since the data is in the campaign database.

The third item (id-00003) was programmatically created by my extension. It has everything it needs to work properly except for one thing: the shortcut class field is incorrectly set to ref_ability. I have tried everything I can think of to get that leaf set to referencefeat, but it just won't work. Below is the onDrop code that generates the database entry:


<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)
Debug.chat("In onDrop");

local winLevel = getWindowAt(x, y);
if not winLevel then
--[[return false;]]
end
Debug.chat("here");
if draginfo.isType("shortcut") then
local sDropClass, sSource = draginfo.getShortcutData();
--[[Module ability information]]
Debug.chat("Here1",sDropClass);
if sDropClass == "referencefeat" then
local nodeSource = DB.findNode(sSource);
--[[local nodeAbility = addEntry(false);]]
Debug.chat("source name=",DB.getValue(nodeSource,"name",""),";type=",DB.getValue(nodeSource,"type",""));
Debug.chat("source node type=",DB.getType(nodeSource));
local nodeAbility=window.getDatabaseNode();
local newWindow=addEntry(false);
if not newWindow then
return false;
end
local newNode=newWindow.getDatabaseNode();
if not newNode then
return false;
end
local sStuff=nodeSource.getChildren();
for k,v in pairs(sStuff) do
Debug.chat("key=",k,";value=",DB.getValue(v,""),";type=",DB.getType(v));
local newChild=newNode.createChild(k,DB.getType(v));
newChild.setValue(DB.getValue(v,""));
end
Debug.chat(DB.getValue(nodeSource,"name",""));
--[[DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));]]
DB.setValue(newNode,"shortcut.recordname","","");
Debug.chat("class before shortcut setting=",sDropClass);
Debug.chat("shortcut class=",DB.getValue(newNode,"shortcut.class","default"));
DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));
DB.setValue(newNode,"origlink","string",sSource);
end
end
end
</script>

This code overrides the list_charabilities class to achieve the desired effect (or so I'd like anyway). The DB.setValue on 'shortcut.class' is the code that is supposed to be setting the class to "referencefeat", but it doesn't work. Any ideas what is going on? I'd be happy to post the extension completely if someone needed to look at it.

Trenloe
March 3rd, 2014, 01:06
The first item in the list (id-00001) is an entry I manually added to the special abilities list of the PFRPG character sheet for a new character. As you can see, it links to a ref_ability window class when you click its link.

The second item in the list (id-00002) is an entry I edited in the database directly to simulate what I want to end up with for the sake of testing. If you click the link on that item, the data will open in the referencefeat window class just as if it had been linked from the library module. The difference is that you don't need to have the module loaded to see it since the data is in the campaign database.

The third item (id-00003) was programmatically created by my extension. It has everything it needs to work properly except for one thing: the shortcut class field is incorrectly set to ref_ability. I have tried everything I can think of to get that leaf set to referencefeat, but it just won't work.
Are you getting the referencefeat and reference_ability classes mixed up here - the ones you show in the code window are: #1 referencefeat, #2 reference_ability, #3 referencefeat.

So, to confirm, you are trying to change the dragged class of referencefeat to reference_ability, yes? So that it displays as text not a link?



<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)
Debug.chat("In onDrop");

local winLevel = getWindowAt(x, y);
if not winLevel then
--[[return false;]]
end
Debug.chat("here");
if draginfo.isType("shortcut") then
local sDropClass, sSource = draginfo.getShortcutData();
--[[Module ability information]]
Debug.chat("Here1",sDropClass);
if sDropClass == "referencefeat" then
local nodeSource = DB.findNode(sSource);
--[[local nodeAbility = addEntry(false);]]
Debug.chat("source name=",DB.getValue(nodeSource,"name",""),";type=",DB.getValue(nodeSource,"type",""));
Debug.chat("source node type=",DB.getType(nodeSource));
local nodeAbility=window.getDatabaseNode();
local newWindow=addEntry(false);
if not newWindow then
return false;
end
local newNode=newWindow.getDatabaseNode();
if not newNode then
return false;
end
local sStuff=nodeSource.getChildren();
for k,v in pairs(sStuff) do
Debug.chat("key=",k,";value=",DB.getValue(v,""),";type=",DB.getType(v));
local newChild=newNode.createChild(k,DB.getType(v));
newChild.setValue(DB.getValue(v,""));
end
Debug.chat(DB.getValue(nodeSource,"name",""));
--[[DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));]]
DB.setValue(newNode,"shortcut.recordname","","");
Debug.chat("class before shortcut setting=",sDropClass);
Debug.chat("shortcut class=",DB.getValue(newNode,"shortcut.class","default"));
DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));
DB.setValue(newNode,"origlink","string",sSource);
end
end
end
</script>

This code overrides the list_charabilities class to achieve the desired effect (or so I'd like anyway). The DB.setValue on 'shortcut.class' is the code that is supposed to be setting the class to "referencefeat", but it doesn't work. Any ideas what is going on? I'd be happy to post the extension completely if someone needed to look at it.
I don't see a DB.setValue for 'shortcut.class' here, only a getValue.

Bidmaron
March 3rd, 2014, 01:28
Are you getting the referencefeat and reference_ability classes mixed up here - the ones you show in the code window are: #1 referencefeat, #2 reference_ability, #3 referencefeat.

So, to confirm, you are trying to change the dragged class of referencefeat to reference_ability, yes? So that it displays as text not a link?


I don't see a DB.setValue for 'shortcut.class' here, only a getValue.

Trenloe, in order to get the fields to show up like in the library module, you have to use referencefeat class. If you want a manually entered/typed ability, the ruleset uses ref_ability. So, as you can see, I have the module information being successfully duplicated by my code into the campaign database, but I just can't get the shortcut to reflect the required class in order to display it (ref_ability is a dumbed-down, one formatted text field window).

As for the DB.setValue missing, sorry about that. I pasted in the wrong code (I had deleted it to try something else). This is the newly dragged special ability database entry (still with the wrong shortcut.class):


<id-00004>
<benefit type="formattedtext">
<p>At 3rd level, a ninja learns to cover her tracks, remain hidden, and conceal her presence. The DC to track a ninja using the Survival skill increases by +1. In addition, her training gives her a +1 insight bonus on Disguise skill checks and on opposed Stealth checks whenever she is stationary and does not take any action for at least 1 round. Every three levels thereafter, the increase to Survival DCs and the bonuses on Disguise and opposed Stealth checks increase by 1.</p>
</benefit>
<mult type="number">0</mult>
<name type="string">No Trace (Ex)</name>
<origlink type="string">reference.ninja.notrace@PFRPG Classes</origlink>
<shortcut type="windowreference">
<class>ref_ability</class>
<recordname></recordname>
</shortcut>
<stack type="number">0</stack>
<type type="string">Class</type>
<value type="string">No Trace (Ex)</value>
</id-00004>


And here is the code with the setValue in it:


if sDropClass == "referencefeat" then
local nodeSource = DB.findNode(sSource);
--[[local nodeAbility = addEntry(false);]]
Debug.chat("source name=",DB.getValue(nodeSource,"name",""),";type=",DB.getValue(nodeSource,"type",""));
Debug.chat("source node type=",DB.getType(nodeSource));
local nodeAbility=window.getDatabaseNode();
local newWindow=addEntry(false);
if not newWindow then
return false;
end
local newNode=newWindow.getDatabaseNode();
if not newNode then
return false;
end
local sStuff=nodeSource.getChildren();
for k,v in pairs(sStuff) do
Debug.chat("key=",k,";value=",DB.getValue(v,""),";type=",DB.getType(v));
local newChild=newNode.createChild(k,DB.getType(v));
newChild.setValue(DB.getValue(v,""));
end
Debug.chat(DB.getValue(nodeSource,"name",""));
--[[DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));]]
DB.setValue(newNode,"shortcut.recordname","","");
Debug.chat("class before shortcut setting=",sDropClass);
DB.setValue(newNode,"shortcut.class","",sDropClass);
Debug.chat("shortcut class=",DB.getValue(newNode,"shortcut.class","default"));
DB.setValue(newNode,"value","string",DB.getValue(nodeSource,"name",""));
DB.setValue(newNode,"origlink","string",sSource);
end

This is just an extract. The other interesting thing is that the Debug.chat that displays "shortcut class=" displays 'default'. That tells me that DB.setValue and getValue are not working on this shortcut.

Trenloe
March 3rd, 2014, 01:39
OK, I was getting extremely confused as your code in post #23 was showing the opposite of what you were describing. You said id-00001 was using the ref_ability class in your text, but the code extract was showing referencefeat as the class, and the same for id-00002 and id-00003 - what you described as the class was actually the opposite.

Bidmaron
March 3rd, 2014, 01:43
Sorry for the confusion Trenloe.

Trenloe
March 3rd, 2014, 01:47
I'm wondering is this might be a case of the FG API blocking access to the <shortcut> section of the database.

Try reading that section (shortcut.class) from an already existing DB entry. If you get nil returned then it is probably that FG is not allowing access to that portion of the database through the API. I experienced a similar issue with image control shortcuts recently.

Bidmaron
March 3rd, 2014, 02:03
I tried, Trenloe, and I get the default field provided or a blank string if no field is provided in the default parameter.

What if I try to create a temporary shortcut database node with the correct fields and then do a copyNode? Do you think that would work? I've never tried copyNode on a non-leaf node before.

JPG, if you have a moment to weigh in on this, I'd sure appreciate it.

Bidmaron
March 3rd, 2014, 04:09
Trenloe, I got the problem solved.

Can you tell me what goes into the weapon and armor proficiency boxes? What is the format of that data and what would you drag there?

Bidmaron
March 3rd, 2014, 04:42
Version 0.1 is now available at the start of the thread.

Nickademus
March 3rd, 2014, 07:55
All this currently does is take care of Nickademus' most pressing problem.

Aw, I feel so pampered.


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.

All four areas of the Abilities tab on the character sheet take the same classes, thus 'feats', 'abilities', and 'proficiencies' are all just feats or formatted text windows.

Bidmaron
March 3rd, 2014, 18:50
Roger, Nickademus. So those fields won't auto-parse to the combat tracker?

Nickademus
March 3rd, 2014, 19:15
I don't follow. What is being parsed to the CT?

Bidmaron
March 3rd, 2014, 20:49
Well, are those fields simply informational and not used at all (e.g. does PFRPG ruleset calculate attack rolls accounting for proficiency entered there?

Can you send me a character that has these blocks filled out as you do them? I take it you don't drag anything there, you just manually type it in.

Nickademus
March 3rd, 2014, 21:39
Those areas are just text to FG. No automation takes the Abilities tab of the character sheet into account.

Currently, I just right-click -> add new entry -> copy/paste from source.

Bidmaron
March 3rd, 2014, 22:54
Well, at least you can drag stuff into feats and special abilities. Would it be useful to be able to drag text into the proficiencies areas (weapon and armor)?

Let me know when you have a chance to confirm my extension is working for you.

Nickademus
March 3rd, 2014, 23:49
Yes, the proficiency feats would be nice as well.

I have a PFS module game tomorrow. After we finish I'll have to level the character and export an xml for the next section of the module. I'll test it then.

Bidmaron
March 4th, 2014, 00:08
When you export, Nickademus, do you open the library, use the Export button and select your character or is there another way?

Nickademus
March 4th, 2014, 00:19
To export a character you click the edit button in the Character window and a down arrow will appear next to each character. Click that to export to a file.

Bidmaron
March 4th, 2014, 03:37
Thanks, Nickademus.

Nickademus
March 10th, 2014, 23:41
Submitted my character after using your module. From my initial tests, I could open abilities after closing the module. Will see tomorrow if I can access them in another GM's game.

Looks good.

Bidmaron
March 11th, 2014, 00:51
Well, I have discovered that it won't work in the mini sheet, but it should work in the main character sheet. I have to go mod the classes in the mini sheet now.

Nickademus
March 12th, 2014, 04:00
My findings were the same as yours. Works fine for me since I only use the mini sheet for the Actions Tab. I tip my hat to you.

Bidmaron
March 12th, 2014, 04:09
Well, I'll fix the mini sheet when I get done with what I'm doing now. Hopefully, you will like what I'm doing next with this. Don't want to discuss it yet in case my lua fu is not up to the task....

darrenan
August 22nd, 2014, 23:24
Not sure if this is supposed to work or not, but you do mention skills above in the list of supported things, so here goes. It appears that dragging skill descriptions from either the Basic or Advanced Rules modules onto the links on the Skills tab of the character sheet is not copying the data i.e. when I close the source module the link no longer works. If that is by design, then no worries, just curious if that's expected to work or not.

damned
August 23rd, 2014, 00:28
If it a link to another module then you have to have that module open...

Trenloe
August 23rd, 2014, 01:21
If it a link to another module then you have to have that module open...
Normally, yes. But the idea behind this extension is that it would copy the data instead of just the link so that you could get to the information if the original module was not available/open.


It appears that dragging skill descriptions from either the Basic or Advanced Rules modules onto the links on the Skills tab of the character sheet is not copying the data i.e. when I close the source module the link no longer works. If that is by design, then no worries, just curious if that's expected to work or not.
I think the original post is misleading, certainly for the extension that is available in that post. This extension only modifies the "list_charabilities" template, which in the 3.5e ruleset is used by feats, special abilities, armour proficiencies and weapon proficiencies - the four fields on the abilities tab. I think the original intent was to do all of the items listed in post #1 but only the above 4 have been implemented in the extension in that post.

darrenan
August 23rd, 2014, 01:48
That's what I suspected, since the link boxes on the skills tab seem to work much differently than the abilities tab.

Bidmaron
August 23rd, 2014, 02:11
Yes, I'd like to get it working on all the stuff in post one, but I'm just not getting the time to get 'er done. The guy I wrote this for (Nickademus) has vanished for the time being, and it didn't seem anyone else was very big on it, so I decided to work on my archival post in the Common forum (Trenloe was nice enough to give me a sticky to do it). I'll eventually get back to it once my job scales back a little.

darrenan
August 23rd, 2014, 02:38
Well, for the record, I love it.

Bidmaron
August 24th, 2014, 01:01
Thanks, darrenan