Page 1 of 3 123 Last
  1. #1
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050

    FGU support of custom unit size?

    Will FGU support custom unit size at release? Meaning will you be able to set the size of a grid to 10ft, or 20ft or 1.3ml or the like?

    I ask because I'd like if this was supported out of the box but if not I'll try and port MUSE over.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  2. #2
    I've added the beginnings of the APIs to do this in FGU; but there is no UI for it yet (and probably won't be at launch). You're welcome to try the new hidden APIs and let me know if they're broken. If you do try this out, please try player side as well.

    The hidden/preliminary APIs are:
    imagecontrol.setDistanceBaseUnits(0) = no override
    imagecontrol.setDistanceBaseUnits(>0) = override value
    imagecontrol.getDistanceBaseUnits() = current base units (override if >0; otherwise ruleset value)
    imagecontrol.setDistanceSuffix(nil) = no override
    imagecontrol.setDistanceSuffix(string) = override value
    imagecontrol.getDistanceSuffix() = current suffix value (override if not nil; otherwise ruleset value)

    Regards,
    JPG
    Last edited by Moon Wizard; November 28th, 2019 at 22:59.

  3. #3
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050
    Quote Originally Posted by Moon Wizard View Post
    I've added the beginnings of the APIs to do this in FGU; but there is no UI for it yet (and probably won't be at launch). You're welcome to try the new hidden APIs and let me know if they're broken. If you do try this out, please try player side as well.

    The hidden/preliminary APIs are:
    imagecontrol.setDistanceBaseUnit(0) = no override
    imagecontrol.setDistanceBaseUnit(>0) = override value
    imagecontrol.getDistanceBaseUnit() = current base units (override if >0; otherwise ruleset value)
    imagecontrol.setDistanceSuffix(nil) = no override
    imagecontrol.setDistanceSuffix(string) = override value
    imagecontrol.getDistanceSuffix() = current suffix value (override if not nil; otherwise ruleset value)

    Regards,
    JPG
    I'll poke around with it and let ya know what I find.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  4. #4
    Thanks a lot for this, Celestian.

    Brazilian D&D and systems that derive from it use "1.5 meters" as a standard, instead of 5'. I had to use MUSE and tweak it a little, it would be great to have it on FGU natively.

  5. #5
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050
    Got a few things lined up and started testing.

    Code:
    [11/18/2019 7:01:39 PM] [NOTICE] Launcher scene starting.
    [11/18/2019 7:01:44 PM] [NOTICE] Spawning private server.
    [11/18/2019 7:01:46 PM] [NOTICE] Connected to game server.
    [11/18/2019 7:01:46 PM] [NOTICE] Launcher scene exiting.
    [11/18/2019 7:01:46 PM] [NOTICE] Tabletop scene starting.
    [11/18/2019 7:04:05 PM] [WARNING] Frame dicetower_normal contains out-of-range values in Middle.
    [11/18/2019 7:04:11 PM] [NOTICE] s'image_record.lua' | s'onInit' | s'test1' | #4 | #0 | #0
    [11/18/2019 7:04:11 PM] [<color="red">ERROR</color>] Script execution error: [string "campaign/scripts/image_record.lua"]:11: attempt to call global 'getDistanceBaseUnit' (a nil value)
    [11/18/2019 7:04:11 PM] [WARNING] Frame d10red contains out-of-range values in TopLeft.
    Here is the code I was attempting to run. I've this in the onInit() to set 10 and ft for values (I'll sort out user places to edit after I've verified this works). It seems the functions do not exist? I can run getGridType() and getGridSize() and hasGrid() so im fairly sure I'm using the right options in the right scope.

    Code:
      if Interface.getVersion() >= 4 then
    Debug.console("image_record.lua","onInit","test1",Interface.getVersion());    
        local nTestSize = getGridSize();
    Debug.console("image_record.lua","onInit","test2",getDistanceBaseUnit());    
    Debug.console("image_record.lua","onInit","test3",getDistanceSuffix());    
    Debug.console("image_record.lua","onInit","test4",nTestSize);    
        setDistanceBaseUnit(10);
    Debug.console("image_record.lua","onInit","test5",Interface.getVersion());    
    --getDistanceBaseUnit() = current base units (override if >0; otherwise ruleset value)
        setDistanceSuffix('ft');
    Debug.console("image_record.lua","onInit","test6",Interface.getVersion());    
    --getDistanceSuffix() = current suffix value (override if not nil; otherwise ruleset value)
    --
      end
    Initially I just tried running sets and when I started getting the error moved the gets to the top to see if it was just the set missing.

    Tangentially related:
    I noticed (before I began to test) is that "half way points" have enormously large float values even when using whole numbers. I think this came with 3.3.9 but I can't be sure. I've not looked/tested this bit for a while.

    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  6. #6
    I just added this line into imagewindow.lua at the end of the onLockChanged function in CoreRPG:
    Debug.console(image.getDistanceBaseUnits());
    And it returned a value.

    Are you sure that you are pointing at the image control?

    Regards,
    JPG

  7. #7
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050
    Quote Originally Posted by Moon Wizard View Post
    I just added this line into imagewindow.lua at the end of the onLockChanged function in CoreRPG:
    Debug.console(image.getDistanceBaseUnits());
    And it returned a value.

    Are you sure that you are pointing at the image control?

    Regards,
    JPG
    So, this might clear up things a little. Here is where the script is attached (trying to just tweak the current code with the adjusted API calls).

    Code:
      <!-- standard image template -->
      <template name="image_record">
        <image_record_step>
          <bounds>21,63,-27,-29</bounds>
          <script file="campaign/scripts/image_record.lua"/>
        </image_record_step>
      </template>
      <!-- desktop image template -->
        <template name="imagepanel_record">
    		<image_record_step>
    			<bounds>1,37,-1,-1</bounds>
                           <script file="campaign/scripts/image_record.lua"/>
    		</image_record_step>
        </template>
      
    ...image_record.lua...
    
    function onInit()
    --
    Debug.console("image_record.lua","onInit","window",window);    
    Debug.console("image_record.lua","onInit","self",self);    
    Debug.console("image_record.lua","onInit","getGridType",getGridType());    
    Debug.console("image_record.lua","onInit","self.getGridType",self.getGridType());    
      if Interface.getVersion() >= 4 then
        local nTestSize = getGridSize();
    Debug.console("image_record.lua","onInit","getDistanceBaseUnit",getDistanceBaseUnit());    
    Debug.console("image_record.lua","onInit","self.getDistanceBaseUnit",self.getDistanceBaseUnit());    
        self.setDistanceBaseUnit(10);
    --getDistanceBaseUnit() = current base units (override if >0; otherwise ruleset value)
        self.setDistanceSuffix('ft');
    --getDistanceSuffix() = current suffix value (override if not nil; otherwise ruleset value)
    --
      end
    
    end
    This is the debug output.

    Code:
    [11/18/2019 8:31:40 PM] [NOTICE] Launcher scene starting.
    [11/18/2019 8:32:17 PM] [NOTICE] Spawning private server.
    [11/18/2019 8:32:19 PM] [NOTICE] Connected to game server.
    [11/18/2019 8:32:19 PM] [NOTICE] Launcher scene exiting.
    [11/18/2019 8:32:19 PM] [NOTICE] Tabletop scene starting.
    [11/18/2019 8:34:31 PM] [WARNING] Frame dicetower_normal contains out-of-range values in Middle.
    [11/18/2019 8:34:49 PM] [NOTICE] s'image_record.lua' | s'onInit' | s'window' | windowinstance = { class = imagewindow, node = [email protected]: The Keep on the Bordelands (L1-3), x,y,w,h = 0,0,1807,1211 }
    [11/18/2019 8:34:49 PM] [NOTICE] s'image_record.lua' | s'onInit' | s'self' | imagecontrol = { name = s'image', x,y,w,h = 21,63,1759,1119 }
    [11/18/2019 8:34:49 PM] [NOTICE] s'image_record.lua' | s'onInit' | s'getGridType' | s'square'
    [11/18/2019 8:34:49 PM] [NOTICE] s'image_record.lua' | s'onInit' | s'self.getGridType' | s'square'
    [11/18/2019 8:34:49 PM] [<color="red">ERROR</color>] Script execution error: [string "campaign/scripts/image_record.lua"]:14: attempt to call global 'getDistanceBaseUnit' (a nil value)
    [11/18/2019 8:34:50 PM] [WARNING] Frame d10red contains out-of-range values in TopLeft.
    [11/18/2019 8:38:32 PM] [NOTICE] Campaign saved.
    Line 14: "Debug.console("image_record.lua","onInit","getDist anceBaseUnit",getDistanceBaseUnit()); "

    If the functions are in imagecontrol then I should be able to use "getDistanceBaseUnit()" or "setDistanceBaseUnit(10)" right? In the same imagecontrol is "getGridType()" which I can get.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,135
    Quote Originally Posted by celestian View Post
    Line 14: "Debug.console("image_record.lua","onInit","getDist anceBaseUnit",getDistanceBaseUnit()); "
    Quote Originally Posted by Moon Wizard View Post
    I just added this line into imagewindow.lua at the end of the onLockChanged function in CoreRPG:
    Debug.console(image.getDistanceBaseUnits());
    Looks like MW has decided to add a "s".
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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!

  9. #9
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050
    Quote Originally Posted by Trenloe View Post
    Looks like MW has decided to add a "s".
    Good catch, I didn't notice that difference from his original post listing the functions. That was it It got past my debug tests after correcting that and changing input to "10" but I'll have to play with it more after day job duties tonight.

    Thanks!



    (I did notice that the half-way markers are no longer calculated for half points as they do in FGC, does the same in CoreRPG).
    Last edited by celestian; November 19th, 2019 at 18:42.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  10. #10
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,050
    I was going to add options to custom/configure the unit size and suffix and ... ran into an issue.



    So, that menu. Where is it in XML? I attempted to find it using my normal detective work (start with finding the tooltip text in the strings file and then find where that is used) but when I searched for "nudge" I couldn't find it in CoreRPG. Is that menu system hard coded currently?
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Log in

Log in