FG Spreadshirt Swag
  1. #1

    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>
    This works fine for "light", "tiny" or "heavy", but not for the default value, which still seem to be strings.
    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);
    to
    Code:
    nEncTotal = nEncTotal + (nCount * tonumber(nWeight));
    As beforem this works fine for "light", "tiny" or "heavy", but not for the default value, then I get the error Script Error: [string "campaign/scripts/manager_char.lua"]:22: attempt to perform arithmetic on a nil value

    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.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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.

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

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by Tatzelbelm View Post
    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.
    Very good. What are you making?
    Sneek peek?

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in