-
March 29th, 2020, 14:11 #1
- Join Date
- Nov 2007
- Posts
- 31
Problem with "button_stringcycler" when trying for a small (More)Core-Modification
I'm trying to do a small modification to the inventory list of character sheets in a moreCore extension.
I'm trying to replace the numeric input field for the item weigth by a "button_stringcycler", which shows the strings "normal", "light", "tiny" or "heavy". The corresponding numeric values are 1, 0.5, 0 and 2.
I've set the button_stringcycler up like this:
Code:<template name="button_cycler_weight"> <button_stringcycler> <anchored height="20" /> <parameters> <defaultlabel mergerule="replace">Normal</defaultlabel> <default>1</default> <labels>Light|Tiny|Heavy</labels> <values>0.5|0|2</values> </parameters> </button_stringcycler> </template>
The manager_char.lua of the CoreRPG throws the error Script Error: [string "campaign/scripts/manager_char.lua"]:22: attempt to perform arithmetic on local 'nWeight' (a string value).
I tried editing manager_char.lua of the CoreRPG to convert nWeight to a number by changing
Code:nEncTotal = nEncTotal + (nCount * nWeight);
Code:nEncTotal = nEncTotal + (nCount * tonumber(nWeight));
Two questions:
1) How can I get rid of the error for the default value of the button_stringcycler?
2) Can I get the extension to use a local modified version of manager_char.lua instead of the CoreRPG manager_char.lua, but keep using all other inventory/weight management files of the CoreRPG?Last edited by Tatzelbelm; March 29th, 2020 at 14:15.
-
March 29th, 2020, 15:08 #2
i think in the Fragged Empire I have some cyclers on the More tab of the Char sheet that have scripts attached to them. Armour I think. Have a look at the setup behind those.
-
March 29th, 2020, 19:04 #3
- Join Date
- Nov 2007
- Posts
- 31
I've got the string_cycler running now. I check if the value read from the string cycler is equal to "", then I set it to my preferred value for the defaul case.
My problem was that the default case of the string cycler always returns the string "" instead of the default value. I then converted "" to a number and got nil.
I've also solved problem #2, just added it to the extension.xml
Thanks for the tip regarding the Fragged Empire cycler.
-
March 30th, 2020, 09:30 #4
-
March 30th, 2020, 16:34 #5
- Join Date
- Nov 2007
- Posts
- 31
It's just a small modification of Valyar's Forbidden Lands Extension.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks