-
July 30th, 2020, 14:48 #1
- Join Date
- Jun 2020
- Posts
- 536
How Powerful is Scripting in Fantasy Grounds
Hey everyone,
I was looking into how scripting works in Fantasy Grounds, looks like it uses LUA. I also found this reference here https://www.fantasygrounds.com/refdoc/.
As a developer myself I was wondering if I could create an extension that, using a certain package or list of assets, can randomly generate a a basic outdoor battle-mat. For instance, say you have an assets folder for backgrounds (plains, forest, swamp, tundra) and for each a folder of random assets for "doodads" (trees, terrain, etc.) Conceivably, a script would then:
- Create a map for the chosen background
- Set the grid to be 'on'
- Sprinkle an amount of doodads in the map based on another variable
- If possible, include LOS data for each doodad (but I think this would probably be... very difficult or impossible, since LOS data is per map)
I was looking to see if something like this already exists, but, I did not see anything, so I wanted to see if it's even possible with FG. Does anyone with experience in making extensions/mods for FG know if there is enough flexibility with the platform to do this?
-
July 30th, 2020, 14:56 #2
Nothing like this already exists.
You would not be able to do this in FGC, since maps are single image files. I suspect it is technically possible in FGU, but no one has yet said they have tried. So their may be some LUA call or such that is not exposed. Note I have seen the devs expose specific LUA calls/functions when other community devs have requested such.
As for LOS, that should be one of the easier parts, because FGU tile assets can already include LOS data with them, so if you can access and call the assets to build your image from, you should be able to include the LOS data.
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
July 30th, 2020, 15:01 #3
- Join Date
- Jun 2020
- Posts
- 536
Thanks for the reply! That's actually good to hear that the part I thought would be hardest is probably actually easiest.
But yes, if I looked into doing this, it would be in FGU. It'll take me some getting used to LUA but I think I could figure it out. I would love to spend some time looking into how maps are currently created/stored by FGU to try to see if it is possible. Perhaps this weekend I can do some digging around to see what calls may be needed.
I think an extension like this would be pretty awesome to go along with random encounters.
-
July 30th, 2020, 15:03 #4
It certainly would be pretty awesome
I'm sure some of the experienced community devs will be along today to give more insightful comments. I haven't done much with FG and and have far more experience writing software requirements than actually implementing them
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
July 30th, 2020, 15:50 #5
- Join Date
- Nov 2018
- Location
- North East USA
- Posts
- 348
If you accomplished this i would exalt your name among great extension devs!
As a DM i love this idea.
-
July 30th, 2020, 16:09 #6
This gives an example of the imagecontrol API:
https://fantasygroundsunity.atlassia...5/imagecontrol
This doesn't look like it has anything new specifically for FGU. I'm guessing that they haven't finalised the FGU image API yet. Hopefully there will be API calls added that will allow you to do what you mentioned in the OP.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!
-
July 30th, 2020, 17:45 #7
- Join Date
- Jun 2020
- Posts
- 536
-
July 30th, 2020, 18:01 #8
Just a heads up, that refdoc you linked is for FG Classic.
The Unity refdoc is much better and is here:
https://fantasygroundsunity.atlassia...eveloper+Guide
Special interest:
https://fantasygroundsunity.atlassia...es+Decorations
https://fantasygroundsunity.atlassia...ta+for+ModulesLast edited by bmos; July 30th, 2020 at 18:07.
bmos' extensions
he/them
-
July 30th, 2020, 18:03 #9
- Join Date
- Jun 2020
- Posts
- 536
Thanks! I'll look through that one later instead
-
July 31st, 2020, 20:45 #10
- Join Date
- Jun 2020
- Posts
- 536
I'm making good progress with, at least, learning how to do things in custom extensions. I have a custom button added to the "Maps" window that creates an Image under a "Maps - Generated" category. Now I am running into a couple issues. (If there is a better forum to post this please let me know!)
- [FIXED] When I set the name of the image (using "image.setValue") it shows on the UI, but it doesn't save to the DB (and reverts to the default name on reload.)
- I haven't figured out how to add layers to the image... is this documented somewhere, or do I need to do it manually with `createChild` and `setValue` ?
Edit: I actually FIXED the first above by checking how images are currently structured in the db.xml. Still can't get layers working though.Last edited by seansps; July 31st, 2020 at 21:28.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks