5E Product Walkthrough Playlist
  1. #1
    Insanity's Avatar
    Join Date
    Mar 2007
    Location
    Terra, Sol system
    Posts
    198

    Math Functions in FGII?

    I've done some searching, but could not find the documentation of the math functions supported in the .xml scripting. In the d20 charsheet_templates.xml file, within the template for abilitybonus, there is a line that reads:

    Code:
    <script>
    				function onSourceUpdate()
    					setValue(math.floor((sources[scorefield[1]].getValue() - sources[damagefield[1]].getValue() - 10) / 2) + getModifier());
    				end
    
    				function onInit()
    					addSource(scorefield[1]);
    					addSource(damagefield[1]);
    
    					super.onInit();
    				end
    			</script>
    This is where the bonuses for an ability are calculated. I've been able to change it to get different results. What I am looking for is how to say round to nearest integer and such. Or even If x>=20, y= type functions. Any ideas?

  2. #2
    LUA is the scripting language used. For the math lib look here for reference https://www.lua.org/manual/5.1/manual.html#5.6

  3. #3
    Insanity's Avatar
    Join Date
    Mar 2007
    Location
    Terra, Sol system
    Posts
    198
    thanks for the source

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
  •  
FG Spreadshirt Swag

Log in

Log in