5E Product Walkthrough Playlist
Page 1 of 2 12 Last
  1. #1

    Help: Simple Number Counter

    New question ... I'm trying to implement a point counter on the character sheet, similar to the total loaded weight field (CoreRPG Ruleset).
    I've been looking at record_char_inventory.xml and found this:

    Code:
    			<simplenumber name="encumbranceload" source="encumbrance.load">
    				<anchored to="encumbranceframe" position="insidetopleft" offset="160,30" width="55" height="20" />
    				<frame name="fieldlight" offset="7,5,7,5" />
    				<readonly />
    			</simplenumber>
    From what I understand, the weight counter is a numeric field that is set to display the value of a certain source, in this case "encumbrance.load".

    Where is this source?

    For example: I have numeric fields A, B and C. I want the sum of these three elements displayed in numeric field "D". I guess i need to store the values of A,B and C somewhere so D can read this as a source???
    How should I proceed?

    Thanks in advance for any help.
    "A saint does what is right. A leader does what is necessary."

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Add some equipment with weight to the Inventory. Give the equipment names like BBBB, CCCC and DDDD and then /save in chat. Open the db.xml and you will see where how these were saved.
    Next you want to find the code that accepted them. You want to use notepad++ (or any similar tool) and its Find in Files feature, an unpacked copy of CoreRPG and start tracking down the code that works for Inventory. Inventory is more complex than some code as it uses lists but thats ok - you will find your code

  3. #3

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    And inventory has lots of derived classes in the various rulesets. Which ruleset are you using?

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,410
    Quote Originally Posted by Alanrockid View Post
    Where is this source?
    In the campaign database. More info on the FG database here: https://www.fantasygrounds.com/modguide/database.xcp
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Quote Originally Posted by Trenloe View Post
    In the campaign database. More info on the FG database here: https://www.fantasygrounds.com/modguide/database.xcp
    I actually forgot that db.xml is located outside the ruleset folder... silly mistake, right?

    But that being said, things are working as intended now. I've already managed to make a simple numeric counter for basic attributes. Thank you for the help!
    "A saint does what is right. A leader does what is necessary."

  6. #6
    Quote Originally Posted by Andraax View Post
    And inventory has lots of derived classes in the various rulesets. Which ruleset are you using?
    CoreRPG
    "A saint does what is right. A leader does what is necessary."

  7. #7
    Quote Originally Posted by damned View Post
    Add some equipment with weight to the Inventory. Give the equipment names like BBBB, CCCC and DDDD and then /save in chat. Open the db.xml and you will see where how these were saved.
    Next you want to find the code that accepted them. You want to use notepad++ (or any similar tool) and its Find in Files feature, an unpacked copy of CoreRPG and start tracking down the code that works for Inventory. Inventory is more complex than some code as it uses lists but thats ok - you will find your code
    And i've found it, indeed! XD

    Do you believe i was actually using windows notepad this whole time? I've followed your advice, including using notepad++, now i feel silly for not doing this ages ago. hahahaha. Things are working as intended now. Thank you for your help!
    "A saint does what is right. A leader does what is necessary."

  8. #8
    So... another question.
    I have this simple numeric counter getting the info from the "forca" in db.xml. It works as intended.

    Code:
    			<simplenumber name="maxencumbranceload" source="forca">
    				<anchored to="encumbranceframe" position="insidetopleft" offset="160,60" width="55" height="20" />
    				<frame name="fieldlight" offset="7,5,7,5" />
    				<readonly />
    			</simplenumber>
    Here's the db.xml relevant info:

    Code:
    			<forca type="number">4</forca>
    			<resistencia type="number">3</resistencia>
    			<habilidade type="number">1</habilidade>
    			<inteligencia type="number">1</inteligencia>
    I want to get the sum of multiple sources, like "Forca"+"Resistencia", but i can't write the source as a attribute in the simplenumber tag because it only allows a single entry, is this right?
    Searching the template_char in the 3.5E ruleset i have found this:

    Code:
    		<number_linked>
    			<frame name="fieldlight" offset="7,5,7,5" />
    			<displaysign />
    			<rollable />
    			<hideonvalue>0</hideonvalue>
    			<source><name>stat</name><op>+</op></source>
    			<source><name>state</name><op>+</op></source>
    			<source><name>...encumbrance.armormaxstatbonusactive</name></source>
    			<source><name>...encumbrance.armorcheckpenalty</name><op>+</op></source>
    			<source><name>ranks</name><op>+</op></source>
    			<source><name>misc</name><op>+</op></source>
    However, if i do something like this in my ruleset nothing happens...

    Code:
    			<simplenumber name="maxencumbranceload">
    				<source><name>forca</name><op>+</op></source>
    				<anchored to="encumbranceframe" position="insidetopleft" offset="160,60" width="55" height="20" />
    				<frame name="fieldlight" offset="7,5,7,5" />
    				<readonly />
    			</simplenumber>
    What am i doing wrong?
    "A saint does what is right. A leader does what is necessary."

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,410
    You only have one <source> defined - "forca" and no other sources being added using <op>, so this will only display the data held in forca, it won't add anything else to it. This also assumes that the "forca" database field is accessible from the database node that the window is anchored to.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  10. #10
    Quote Originally Posted by Trenloe View Post
    You only have one <source> defined - "forca" and no other sources being added using <op>, so this will only display the data held in forca, it won't add anything else to it. This also assumes that the "forca" database field is accessible from the database node that the window is anchored to.
    I have used just one source as an example, because when i use <whatever source="forca"> it works ok, but when i do <whatever><source>forca</source></whatever> or <whatever><source><name>forca</name></source></whatever> it does nothing... should'nt it be the same thing? I'm a little confused by this...
    "A saint does what is right. A leader does what is necessary."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •  
DICE PACKS BUNDLE

Log in

Log in