PDA

View Full Version : Adding Talent to Sidebar - Error



augustgames
March 25th, 2024, 18:14
So I am teaching myself how to play with FG Rulesets. So far it has been a blast. I ran into a problem that I can't seem to figure out. I am sure it is simple.

1. I added "TALENTS" to the sidebar and created a form
2. I click on the ican and it opens up the box
60352
3. When I click the green PLUS button to add a record I get the following error:
[ERROR] Script execution error: [string "CoreRPG:..n/scripts/campaign_button_new.lua"]:23: createChild: Invalid argument 1

I am sure I missed something basic. Help would be appreciated as I learn.

Daniel.

Trenloe
March 25th, 2024, 18:23
How have you defined the library aRecord entry for Talents?

Make sure you review the comments and examples in the CoreRPG scripts\data_library.lua file. It's possible you may not have defined a valid entry for aDataMap, but without seeing the code for how you've gone about this we can't be sure.

augustgames
March 25th, 2024, 19:42
I will do that!

FYI - I used Ruleset Wizard to make the form and added this script. Sorry, I should have included this. It was pre-coffee.

function onInit()

LibraryData.aRecords["talents"]= {
bExport = True,
aDatamap = {"talents","reference.talents"},
asDisplayIcon = {"sidebar","sidebar_down"},
sRecordDisplayClass = "talents",
}
end

superteddy57
March 25th, 2024, 19:52
Well from above it's looking for a declared windowclass named 'talents'. Once you have that setup it should open the window without an error.

augustgames
March 25th, 2024, 20:30
I commented it out and I still get the same error "[ERROR] Script execution error: [string "CoreRPG:..n/scripts/campaign_button_new.lua"]:23: createChild: Invalid argument 1"

I made sure the form and library data were lined up

LibraryData.aRecords["talent"]= {
bExport = True,
aDatamap = {"talent","reference.talent"},
asDisplayIcon = {"sidebar","sidebar_down"},
--sListDisplayClass = "master_talent",
}


Here is the form

<root>
<windowclass name="talent">
<placement>
<size height="300" width="300" />
</placement>
<sizelimits resize="both">
<hostcontrol />
</sizelimits>
<sheetdata>
<stringfield name="talent_name">
<bounds>30,9,150,20</bounds>
<controlline />
<lineoffset>-2</lineoffset>
</stringfield>
<linkfield name="talent_lnk">
<bounds>4,3,20,20</bounds>
<description>
<field>name</field>
</description>
<class>talent</class>
<selfonempty />
</linkfield>
<stringfield name="talent_desc">
<bounds>30,36,150,26</bounds>
<controlline />
<lineoffset>-2</lineoffset>
</stringfield>
</sheetdata>
</windowclass>
</root>

superteddy57
March 25th, 2024, 20:34
I would have to see the full code to give more direct pointers as the windowclass doesn't appear any issues. Other areas might be looking in the console and see if something isn't loading or bad templates.

augustgames
March 25th, 2024, 20:40
I really appreciate it. I feel a bit stuck. I attached a link to my dropbox with to my corerpg.pak and HereAfter Fantasy.pak

https://www.dropbox.com/scl/fo/troy6ct2osrwndn2aox4r/h?rlkey=ywzu128fxhfaqt76dfdsjk2if&dl=0

Trenloe
March 25th, 2024, 20:42
The error listed in post #1 is caused by the button code not returning a valid node from window.getDatabaseNode(). Which suggests that the talents list window hasn't been correctly initiated with an underlying database node. I'm not sure what's causing that to occur, and I don't have time to dive into the code.

@augustgames - I don't think asDisplayIcon is a valid variable in the usual CoreRPG based rulesets, is this something specific to the ruleset you're using? Although I don't think this would cause the issue.

Trenloe
March 25th, 2024, 20:43
I really appreciate it. I feel a bit stuck. I attached a link to my dropbox with to my corerpg.pak and HereAfter Fantasy.pak

https://www.dropbox.com/scl/fo/troy6ct2osrwndn2aox4r/h?rlkey=ywzu128fxhfaqt76dfdsjk2if&dl=0
Have you modified CoreRPG or are you using the standard version?

augustgames
March 25th, 2024, 21:01
Standard. I have not changed anything.

augustgames
March 25th, 2024, 21:22
One observation. The Talent list does NOT have title. Trying to find where you define those.

Trenloe
March 25th, 2024, 21:23
The error listed in post #1 is caused by the button code not returning a valid node from window.getDatabaseNode(). Which suggests that the talents list window hasn't been correctly initiated with an underlying database node.


It's possible you may not have defined a valid entry for aDataMap...

This was the cause. LUA is case sensitive, so you need to be careful to use the exact same case for variables, etc..

Use this, I've highlighted what had incorrect case:


function onInit()

LibraryData.aRecords["talent"]= {
bExport = true,
aDataMap = {"talent","reference.talent"},
sRecordDisplayClass = "talent"
}
end

augustgames
March 25th, 2024, 21:36
I will dig into this. As I coder I should have known better :(

THANK YOU!

Moon Wizard
March 25th, 2024, 22:32
Also, you should be using LibraryData.setRecordTypeInfo("talent", { ... }) or LibraryData.overrideReceordTypeInfo("talent", { ... }), instead of trying to modify the table directly. This is how existing rulesets and extensions do it.

Regards,
JPG