PDA

View Full Version : Drag and Drop abilities - Savage Rifts



GunbunnyFuFu
September 18th, 2020, 12:06
Good day!

I'm working on trying to get the abilities in the Savage Rifts product (soon to be released) so that the abilities are automatically dropped on the character sheet when the iconic framework is selected. I've not had much luck with it, sadly. I'm still learning to code in Lua. What I have is this:



function onFrameworkDrop(nodeChar, draginfo)
if nodeChar and draginfo.isType("shortcut") then
local sClass, sRecord = draginfo.getShortcutData()
local nodeFramework = draginfo.getDatabaseNode()
if sClass == "sw_referenceframework" and nodeFramework then
DB.setValue(nodeChar, "framework", "string", DB.getValue(nodeFramework, "name", ""))
DB.setValue(nodeChar, "frameworklink", "windowreference", sClass, sRecord)
local rActor = CharacterManager.getActorShortcut("pc", nodeChar)
local nodeAbilities = DB.createChild(nodeChar, "special")
for _,nodeFrameworkAbility in pairs(NodeManager.getChildrenOrdered(nodeFramework , "abilities")) do
local nodeAbility = DB.createChild(nodeAbilities)
DB.setValue(nodeAbility, "name", "string", DB.getValue(nodeFrameworkAbility, "name", ""))
DB.setValue(nodeAbility, "description", "string", DB.getValue(nodeFrameworkAbility, "description", ""))
DB.setValue(nodeAbility, "link", "windowreference", "sw_referencefeat", nodeFrameworkAbility.getNodeName())
CharacterManager.importAbilityEffects(rActor, nodeAbility)
end
return true
end
end
return false
end


What am I doing wrong?

Thanks,

GBFF

Moon Wizard
September 18th, 2020, 18:25
You'd have to provide examples of what the framework record XML looks like to be able to have an idea what is going on since the framework is a new record type that doesn't exist in SW ruleset.

Regards,
JPG

GunbunnyFuFu
September 18th, 2020, 19:28
JPG,

Thanks for the reply! See below.



?xml version="1.0" encoding="iso-8859-1"?>

<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->

<root>
<windowclass name="sw_referenceframework">
<frame>recordsheet</frame>
<placement>
<size width="350" height="350" />
</placement>
<sizelimits>
<minimum width="350" height="350" />
<dynamic />
</sizelimits>
<minimize>minimized_reference</minimize>
<tooltip field="name" />
<playercontrol />
<sharable />
<nodelete />
<script file="campaign/scripts/framework.lua" />
<sheetdata>
<sub_record_header name="header">
<class>framework_header</class>
</sub_record_header>

<frame_record_content name="contentframe" />

<subwindow_record name="content">
<class>framework_main</class>
<activate />
</subwindow_record>
<scrollbar_record>
<target>content</target>
</scrollbar_record>

<viewerlist_recordsheet />

<resize_recordsheet />
<close_recordsheet />
</sheetdata>
</windowclass>

<windowclass name="framework_header">
<margins control="0,0,0,7" />
<script file="campaign/scripts/record_header.lua" />
<sheetdata>
<link_record_header>
<class>sw_referenceframework</class>
</link_record_header>

<anchor_record_header_right name="rightanchor" />
<icon_record_locked />
<button_record_locked />

<string_record_name name="name">
<empty textres="library_recordtype_empty_race" />
</string_record_name>
</sheetdata>
</windowclass>

<windowclass name="framework_main">
<margins control="0,0,0,2" />
<script file="campaign/scripts/framework_main.lua" />
<sheetdata>
<anchor_column name="columnanchor" />

<ft_columnh name="text" />

<header_column name="abilities_header">
<static textres="race_header_abilities"/>
<center />
</header_column>
<button_iedit name="abilities_iedit">
<anchored to="abilities_header" position="righthigh" offset="-20,0" />
<target>abilities</target>
</button_iedit>
<button_iadd name="abilities_iadd">
<anchored to="abilities_iedit" position="lefthigh" offset="5,0" />
<target>abilities</target>
</button_iadd>
<list_column_sw name="abilities">
<datasource>.abilities</datasource>
<class>ref_race_ability</class>
</list_column_sw>
</sheetdata>
</windowclass>

<windowclass name="ref_framework_ability">
<margins control="0,0,0,2" />
<script file="campaign/scripts/framework_ability.lua" />
<sheetdata>
<anchor_listitem_column_right name="rightanchor" />
<button_listitem_column_delete name="idelete">
<anchored>
<right relation="relative" />
</anchored>
</button_listitem_column_delete>
<link_listitem_column name="shortcut">
<class>sw_referencefeat</class>
</link_listitem_column>

<record_stringline name="name">
<anchored position="insidetopleft" offset="5,4">
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
<font>sheetlabel</font>
<empty textres="library_recordtype_empty_racialability" />
<script>
function onGainFocus()
window.description.updateState(true)
end
function onLoseFocus()
window.description.updateState()
end
</script>
</record_stringline>

<record_stringline_h name="description">
<anchored to="name" position="below" offset="2">
<left offset="15" />
</anchored>
</record_stringline_h>
</sheetdata>
</windowclass>
</root>

Moon Wizard
September 18th, 2020, 21:59
Thanks for the window definitions.
Can you post an example of a XML framework record from the module too?

JPG

GunbunnyFuFu
September 19th, 2020, 01:56
Here's the <list> entry:



<burster>
<name type="string">Burster</name>
<listlink type="windowreference">
<class>sw_referenceframework</class>
<recordname>reference.frameworks.burster</recordname>
</listlink>
</burster>


And the framework itself:



<burster>
<name type="string">Burster</name>
<text type="formattedtext">
LOTS OF DETAILS ABOUT THE BURSTER IN FORMATTED TEXT
</text>
<abilities>
<arcane_background>
<name type="string">Arcane Background: Psionics</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>A Burster begins with Arcane Background (Psionics) choosing three powers from the list above, the Blaster and Major Psionic Edges, and a d6 Psionics skill. Bursters begin with 20 ISP (10 ISP base, doubled by the Major Psionic Edge).</p>
</benefit>
</arcane_background>
<everything_burns>
<name type="string">Everything Burns</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>The fires started by the Burster are some of the most intense possible and can set almost any material aflame. When a Burster scores a raise on a damage-causing attack roll using one of their abilities, the target catches fire taking 3d6 damage until doused (see <b>Fire </b>in <i>Savage Worlds </i>).</p>
</benefit>
</everything_burns>
<fiery_aura>
<name type="string">Fiery Aura</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>As an action (no roll or ISP required) a Burster can surround himself with a damage field of flame and heat, causing 3d6 damage to adjacent foes at the end of each of his rounds, and providing +6 Armor to himself (stacks with protection and natural armor, but not worn armor). This fiery aura also adds 1d6 damage to any Fighting attack he makes. If the Burster spends 3 ISP when activating Fiery Aura, for the next five rounds the damage becomes Mega Damage and the Armor provided gains the MDC quality. Fiery Aura goes away whenever the Burster is Incapacitated or unconscious.</p>
</benefit>
</fiery_aura>
<fire_mastery>
<name type="string">Fire Mastery</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>The Burster has the Innate Ability to create, control, and eliminate minor fire, heat, and smoke effects using <i>elemental manipulation </i>for no ISP. As an action, she may activate the Elemental Fury or Exalted Manipulation modifier costing no ISP. Non-arcane environmental protection has no effect against this ability.</p>
</benefit>
</fire_mastery>
<firewalker>
<name type="string">Fire Walker</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>Bursters have Immunity to all sources of fire, heat, and plasma damage; he could take a dive into a river of lava and come out unscathed. He has Environmental Immunity to Heat and Fire environmental Hazards, and gains +4 on rolls to resist heat-based arcane effects. Bursters take -4 damage from lightning or electrical attacks as well as laser, ion, and particle beam weapons.</p>
</benefit>
</firewalker>
<flame_bolt>
<name type="string">Flame Bolt</name>
<type type="string">Ability</type>
<benefit type="formattedtext">
<p>The Burster can hurl forth a flaming bolt of 3d6 Mega Damage (4d6 on a raise) for one ISP, or 4d6 Mega Damage (5d6 on a raise) for two ISP. Additional Power Modifiers may be used as normal. Flame Bolt is Range Smarts &#215;2 and counts as a Mega Power Modifier for the purpose of utilizing the Blaster Edges and their Power Modifiers.</p>
</benefit>
</flame_bolt>
<cybernetics>
<name type="string">Cybernetics</name>
<type type="string">Complication</type>
<benefit type="formattedtext">
<p>Cyberware isn't a good option for a Burster as they interfere too much with his powers. If circumstances force a bionic addition, each point of Strain imposes a &#45;1 penalty to the Psionics skill.</p>
</benefit>
</cybernetics>
<enemies>
<name type="string">Enemies</name>
<type type="string">Complication</type>
<benefit type="formattedtext">
<p>As with any powerful psychic, the Coalition and True Federation consider Bursters allied with enemy factions a dire threat to life and property. They prioritize attacking them when hostilities break out and hunt them with extreme prejudice.</p>
</benefit>
</enemies>
<quirk>
<name type="string">Quirk-Pyromaniac</name>
<type type="string">Complication</type>
<benefit type="formattedtext">
<p>Though most are not sociopathic arsonists, Bursters tend to have a thing about starting fires just to watch them burn with loving fascination. This is more aggravating than dangerous (at least most of the time).</p>
</benefit>
</quirk>
</abilities>
</burster>


GBFF

GunbunnyFuFu
September 21st, 2020, 16:35
Any other XML/LUA code needed?

GBFF

GunbunnyFuFu
September 26th, 2020, 20:24
Still looking/hoping for assistance with this.

GBFF

GunbunnyFuFu
October 1st, 2020, 01:46
Bump! Still looking for ideas on this while I work on learning how to read the code/make it function and do what I want it to do.

GBFF

Moon Wizard
October 1st, 2020, 03:56
It looks like the logic is basically sound; but I'm not familiar with SW ruleset to know whether the data is being placed in the right places.

For example,
* Is charsheet.id-#####.special the correct place to create a list of abilities?
* Does the window class that displays the ability record have "name", "description" and "link" fields?
* How do other scripts use the special list or individual special records (if any)?
* What does NodeManager.getChildrenOrdered actually do? (Not part of CoreRPG)
* What does CharacterManager.importAbilityEffects do?

In general, I would start by adding Debug.chat or Debug.console statements between each line in your script to see what is being used and returned for the functions, and ensure that is what you expect to see at that point.

Regards,
JPG

esmdev
October 1st, 2020, 18:42
As a customer of several rulesets and modules, it seems to me that there needs to be a better support mechanism for developers of licensed products. Like a ruleset guru that the various developers can go to for specific advise on basic stuff like implementing drag and drop or building the coding side of effects. This thread has been here for a couple of weeks, had to be bumped three times by the dev, and the final answer was basically your on your own, good luck.

SilentRuin
October 1st, 2020, 19:26
As a customer of several rulesets and modules, it seems to me that there needs to be a better support mechanism for developers of licensed products. Like a ruleset guru that the various developers can go to for specific advise on basic stuff like implementing drag and drop or building the coding side of effects. This thread has been here for a couple of weeks, had to be bumped three times by the dev, and the final answer was basically your on your own, good luck.

Its one of the pitfalls of coding. You don't have enough experienced people to donate free time to shepherd all the people trying to code extensions and such. You can give them the documents - examples - tools - but at some point (like me) you have to spend a large amount of time trial and error and leaning on your own. If people have the time - its great that they are willing to donate that extra time.

But your post request reads like you are saying that in addition to the very limited FGU development resources that do constantly interact with the community with good advice on a daily basis - plus work on all the stuff they have to work on with the product - that they should also stretch those resources to individual tutoring sessions in complex unique extensions of the code.

Maybe I misread what your saying - in which case sorry about that. But if I read it correctly - I strongly disagree. The FGU resources need to be on getting FGU live. First and foremost.

esmdev
October 1st, 2020, 19:31
I am not talking about random developers, I am specifically talking about developers of products that SmiteWorks is selling to its customers that (using this thread as an example) are trying to build basic expected functionality to a brand new licensed, store bought product.

SilentRuin
October 1st, 2020, 19:37
I am not talking about random developers, I am specifically talking about developers of products that SmiteWorks is selling to its customers that (using this thread as an example) are trying to build basic expected functionality to a brand new licensed, store bought product.

Ok maybe this is my misunderstanding then and you can clear it up for me. Smiteworks has its own development shop with the core code and a set of rulesets they deliver with their licenses. Those are theirs I assume correct?

Anyone outside of that shop - who builds and delivers rulesets on their own - is pretty much like me and other extension developers - doing our own things with the resources, examples, and donated time and advice in the forums here.

So I and these people I assume are the random developers.

I suppose I'm having trouble understanding who the non random developers are who are not part of Smiteworks or directly affiliated with them. I assume in house devs and affiliates do not ask questions on the forums.

esmdev
October 1st, 2020, 20:08
Ok maybe this is my misunderstanding then and you can clear it up for me. Smiteworks has its own development shop with the core code and a set of rulesets they deliver with their licenses. Those are theirs I assume correct?

Anyone outside of that shop - who builds and delivers rulesets on their own - is pretty much like me and other extension developers - doing our own things with the resources, examples, and donated time and advice in the forums here.

So I and these people I assume are the random developers.

I suppose I'm having trouble understanding who the non random developers are who are not part of Smiteworks or directly affiliated with them. I assume in house devs and affiliates do not ask questions on the forums.

https://www.fantasygrounds.com/store/product.php?id=PEGFGSWRTTLPG

GunbunnyFuFu
October 1st, 2020, 20:39
I'm not a random developer. I'm a community developer (with several products in the store that Smiteworks sells) looking to further enhance a product at the request of those who have purchased the licensed product. Regardless, while I'd love to see someone available to help us community devs, I'm not adverse to learning, so that's what I'm working on. What that does mean, however, is that the other 6 books in the Rifts line will likely be delayed, as free time is a finite thing. However, it's all good. I'll figure it out.

GBFF

Moon Wizard
October 1st, 2020, 20:55
In this case, I'm trying to provide advice to help GunbunnyFuFu with a ruleset that I am not familiar with, thus my advice is admittedly limited and general.

We provide best effort support for ruleset, extension and module coding as we have time between other projects. That time tends to vary quite a bit over time as primary projects take time and priority (such as FGU releases). This is why it took a while to answer the original question.

Plus, the original question was quite involved, and required knowledge not just of Savage Worlds ruleset but of the extension and data being added as well. It's one of the reasons why we point people to the forums, so that the community at large can assist in the process and so that anything we work through is available for all developers to use or review.

Basically, we have Dominic and myself working on trying to monitor the forums among all our other tasks. Also, we can only cover so much, because each ruleset is it's own unique scripting and UI environment. While I am very familiar with the systems that I helped write (CoreRPG, 5E, ...); there are even more systems that I have no idea how they were implemented (SavageWorlds, Conan, BoL, Vampire, ...). The amount of resources needed to have an expert on staff for every ruleset produced is outside the scope of what we can do with the size of our team, and the revenue generated by those systems.

Regards,
JPG

Moon Wizard
October 1st, 2020, 20:57
@GunbunnyFuFu,

Regardless of the somewhat unrelated posts, did you try any of the suggestions I sent? Did they reveal anything?

I was hoping Ikael might be able chime in, since he is the developer on the Savage Worlds ruleset, but he has been busy. Maybe you could ping him on Discord as well?

Regards,
JPG

GunbunnyFuFu
October 1st, 2020, 21:07
JPG,

I appreciate your assistance, and understand the situation with the limited amount of resources SmiteWorks has. I have worked on learning basics of Lua. I have pinged him and am learning the basics at his suggestion.

GBFF

GunbunnyFuFu
October 2nd, 2020, 00:39
@Moon Wizard,

I did try debug commands, but got nothing back in the console. I'm going to try some basic hello-world sort of functions and debug them to make sure I'm debugging correctly, and then proceed from there.

Again, thanks for your insight and your help!

GBFF

Moon Wizard
October 2nd, 2020, 00:42
Make sure to move the Debug commands up in the code until you see them trigger (i.e. right at the top of ReceiveDrop, for example). If they're not triggering at all, then it might be a template or window merge issue.

Regards,
JPG