5E Product Walkthrough Playlist
Page 2 of 2 First 12
  1. #11
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    The <simplenumber> control template won't work, it does not have the code to use the multiple <source> and <op> properties. You need to use the <number_linked> control template.
    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!

  2. #12
    Quote Originally Posted by Trenloe View Post
    The <simplenumber> control template won't work, it does not have the code to use the multiple <source> and <op> properties. You need to use the <number_linked> control template.
    Thats it! It worked! Thank you!

    Also, is there any way to do some slightly more complex operations, like Attribute*2 + attribute2*3?
    "A saint does what is right. A leader does what is necessary."

  3. #13
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by Alanrockid View Post
    Also, is there any way to do some slightly more complex operations, like Attribute*2 + attribute2*3?
    The code steps through each <source> entry in order and applies the <op> mathematical function using the value of the database field pointed to by <source><name>. Supported <op> mathematical functions are: +, -, *, - and neg+ (only add the value of the source if it is negative).

    So, from this, you can't do "Something * 2" unless you have a database field containing "2" that you can point the source to. Plus, the process doesn't follow the mathematics BODMAS order for processing, so you can't do "Attribute*2 + attribute2*3".

    If you want to do mathematical calculations like this then you'll probably have to look at writing the code in LUA and using onUpdate event handlers against the sources to trigger an update in the target field. See "Handler functions" here: https://www.fantasygrounds.com/modguide/scripting.xcp Or have intermediate <number_linked> fields that store their result in the database and then use these database fields in the final result. e.g. one <number_linked> field to calculate Attribute*2, one <number_linked> to calculate attribute2*3 and a final <number_linked> field to add the two together. You can make the first two fields invisible so they aren't shown on the GUI. But this would be quite a complex approach to something that could be covered in LUA using handler functions.
    Last edited by Trenloe; July 28th, 2016 at 16:56.
    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!

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
  •  
Starfinder Playlist

Log in

Log in