PDA

View Full Version : Adding a new tab to character sheet in Savage Worlds.



Draeus
December 30th, 2016, 19:29
I am attempting to add another tab to the Savage worlds Character sheet.

I am wanting to add a page from the CORE RPG ruleset abilities tab.

I have very little knowledge of Lua script and XML but I have been able to follow it with a little research and frustration.

I have some scripting knowledge, so please consider me a beginner.

I have managed to eliminate all errors but this:
17130

The sheet is blank when I click on the tab and throws up the console error.

Any help would be appreciated.
Regards
Draeus

Zhern
December 30th, 2016, 19:44
Can you post the code too? Hard to debug an error without the code.

Draeus
December 30th, 2016, 20:46
Can you post the code too? Hard to debug an error without the code.


This is the code I have in the charsheet_gmd.xml



<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Copyright SmiteWorks USA, LLC., 2010 -->
<!-- GMD club character sheet tab for savage worlds, attempt 1 -->
<root version="2.0">
<windowclass name="charsheet_gmd">
<placement>
<size width="252" height="611" />
</placement>
<nodelete />
<sheetdata>
<char_header name="header" />

<!-- code taken from CoreRPG Abilities -->
<frame_char name="gmdframe">
<anchored width="500" height="550">
<left offset="35"/>
<top parent="header" anchor="bottom" offset="5" />
</anchored>
</frame_char>
<label_char_center>
<anchored to="gmdframe"/>
<static>GMD Club Page</static>
</label_char_center>
<list_text name="gmdabilities">
<anchored to="gmdframe"/>

<columns width="222" filldown="true" />
<newfocus>name</newfocus>
<datasource>.abilitylist</datasource>
<class>char_ability</class>
<acceptdrop>
<class>referencetext</class>
<class>referencetextwide</class>
<field>*</field>
</acceptdrop>
</list_text>
<scrollbar_list>
<anchored to="gmdabilities" />
<target>abilities</target>
</scrollbar_list>

<button_iedit name="gmdabilities_iedit">
<anchored to="gmdabilities" position="aboveright" offset="5,5" />
<target>abilities</target>
</button_iedit>
<button_iadd name="gmdabilities_iadd">
<anchored to="gmdabilities_iedit" position="lefthigh" offset="5,0" />
<target>abilities</target>
</button_iadd>
</sheetdata>
</windowclass>

<windowclass name="char_gmdability">
<margins control="0,0,0,2" />
<sheetdata>
<genericcontrol name="rightanchor">
<anchored height="0" width="0">
<top offset="2" />
<right />
</anchored>
</genericcontrol>
<button_idelete name="idelete">
<anchored to="rightanchor">
<top />
<right anchor="left" relation="relative" offset="-5" />
</anchored>
</button_idelete>
<linkfield name="shortcut">
<anchored to="rightanchor" width="20" height="20">
<top />
<right anchor="left" relation="relative" offset="-5" />
</anchored>
<class>ability</class>
<description field="name" />
<readonly />
</linkfield>
<string_textlistitem name="name">
<anchored to="rightanchor">
<top />
<left parent="" offset="5" />
<right anchor="left" relation="relative" offset="-5" />
</anchored>
<multilinespacing>20</multilinespacing>
</string_textlistitem>
</sheetdata>
</windowclass>
</root>

Zhern
December 30th, 2016, 21:15
The error indicates you are trying to access an undefined (or nil) field. Looking at the code in the template_tabcontrol.lua, line 13 is trying to set the tab invisible but can't because the tab at that index isn't defined. I can't really say more unless I dig into it. I haven't modified tabs yet in the ruleset I'm working on. I'm sure one of the more experienced folks can guide you better.

Here is the code for the script:



function activateTab(index)
index = tonumber(index)
if index > 0 and index < #tabs+1 then
-- Hide active tab, fade text labels
tabs[tabIndex].widget.setColor("80ffffff")
window[tabs[tabIndex].subwindow].setVisible(false)
if tabs[tabIndex].scroller then
window[tabs[tabIndex].scroller].setVisible(false)
end

-- Set new index
tabIndex = index;

-- Move helper graphic into position
topWidget.setPosition("topleft", 5, TAB_SIZE*(tabIndex-1)+7)
if tabIndex == 1 then
topWidget.setVisible(false)
else
topWidget.setVisible(true)
end

-- Activate text label and subwindow
tabs[tabIndex].widget.setColor("ffffffff")

window[tabs[tabIndex].subwindow].setVisible(true)
for _,tab in pairs(tabs) do
tab.widget.bringToFront()
end
if tabs[tabIndex].scroller then
window[tabs[tabIndex].scroller].setVisible(true)
end
end
end

Draeus
December 31st, 2016, 11:03
I've looked at the adventure deck extension that adds additional tab with no issues. The extension does not alter that script as far as I'm aware.

I have managed to get the tab to appear. But when pressing on the table it throws up the error above and I am unable to then switch to a different tab

Thankyou for your assistance so far.

Ikael
December 31st, 2016, 12:55
In SavageWorlds ruleset you will need to register your charsheet tab page in lua. The approach you would use in other CoreRPG derived ruleset is not enough/viable. You can find the example codes how to do that in Adventure Deck extension but I have also posted sample extension how to do that in these forms but could not find it when quickly glazing through

Draeus
December 31st, 2016, 14:21
In SavageWorlds ruleset you will need to register your charsheet tab page in lua. The approach you would use in other CoreRPG derived ruleset is not enough/viable. You can find the example codes how to do that in Adventure Deck extension but I have also posted sample extension how to do that in these forms but could not find it when quickly glazing through

thank you Ikeal


My extension has the following folders and files in each folder:
charsheet - inside this folder are : charsheet.xml & charsheet_gmd.xml
graphics - inside this folder are : icons folder currently empty & tabs folder containing the tab png file & graphics.xml file
scripts - manager_charsheet.lua
extension.xml

manager_charsheet.lua code:


-- Copyright SmiteWorks USA, LLC., 2011

function onInit()
CharacterSheetManager.registerSheet("gmd", "gmd_charsheet", "tab_gmd")
end


Am I missing something?

Ikael
December 31st, 2016, 18:13
Can you post extension.xml file's content here?

Draeus
January 1st, 2017, 14:39
Can you post extension.xml file's content here?


Sorry for delay, New Years and all that! Here's the code:
extension.xml



<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Used Adventure deck code as a base to learn from. -->
<root version="3.0">

<properties>
<name>GMD Online</name>
<version>1.0</version>

<author>GMD</author>
<description>GMD Online Extension</description>
<loadorder>25</loadorder>
</properties>

<base>

<includefile source="charsheet/charsheet.xml"/>
<includefile source="graphics/graphics.xml"/>

<!-- HIGH-LEVEL SCRIPTS -->
<script name="GMDCharsheetManager" file="scripts/manager_charsheet.lua"/>

</base>
</root>

Draeus
January 5th, 2017, 11:35
Do you think there could be so.ething missing from this file?

Ikael
January 5th, 2017, 12:08
Do you think there could be so.ething missing from this file?

I believe the issue might be that in CharacterSheetManager.registerSheet you reference directly to windowclass implementation. Instead it would be "wrapped" with charsheet_sheet template. See code sample below:



<template name="contacts_charsheet">
<charsheet_sheet>
<class>charsheet_contacts</class>
</charsheet_sheet>
</template>

<windowclass name="charsheet_contacts">
<placement>
<size width="252" height="611"/>
</placement>
<nodelete />
<sheetdata>
<char_header name="header" />
...
</sheetdata>
</windowclass>

<script name="SWContactsLauncher">
function onInit()
CharacterSheetManager.registerSheet("contacts", "contacts_charsheet", "tab_other")
end
</script>

Draeus
January 5th, 2017, 14:26
I believe the issue might be that in CharacterSheetManager.registerSheet you reference directly to windowclass implementation. Instead it would be "wrapped" with charsheet_sheet template. See code sample below:


Thank you Ikael.

It appears that during my editing I had deleted the template references.

i now have a tab so i'm off to fill the page with required content!

Once again thank you.