Thread: FGU support of custom unit size?
-
November 18th, 2019, 03:18 #1
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.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
November 18th, 2019, 07:15 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
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,
JPGLast edited by Moon Wizard; November 28th, 2019 at 21:59.
-
November 18th, 2019, 16:20 #3---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
November 18th, 2019, 17:58 #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.
-
November 19th, 2019, 01:14 #5
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.
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
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.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
November 19th, 2019, 01:36 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
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
-
November 19th, 2019, 02:39 #7
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
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 = image.id-00016@B2: 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.
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.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
November 19th, 2019, 16:56 #8Private 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!
-
November 19th, 2019, 17:39 #9
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 17:42.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
November 20th, 2019, 02:31 #10
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?---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks