View Full Version : Coding extensions?
Milke
August 16th, 2025, 22:31
I have zero experience with .lua
What do most of you do to make extensions? Do you actually code it by hand? I've been trying to get ChatGPT to make an extension for the last 24 hours. I've tried about 26 variations of the extension it's tried to make for me. And about 26 times I've told it it didn't work, and been told, "You're sure right. That code doesn't work. I have narrowed down the reason. Try this new code. This will DEFINITELY work." (it doesn't work)
And it's not even an extension I really need. I just came up with something that (seemed) simple to see if I could get it done.
Trenloe
August 17th, 2025, 16:40
I've moved this post to "The Workshop" sub-forum. This is the best place to ask questions about coding extensions in FG.
LordEntrails
August 17th, 2025, 16:59
www.rulesetwizard.com
It won't help with LUA, but neither does ChatGPT.
RSW is great, but be warned, it will let you create extensions and rulesets quickly, but is also easy to brute force things and overwrite core capabilities that then makes your extension harder to maintain as FG updates.
There are too many flavors of LUA for ChatGPT to give you working code. But it can give you samples to work with that then with your intelligence and coding skills you can improve and make work. But you can do the same thing using FG code itself. Consider combining the two methods.
Besides the FG code itself as reference, see Developer Guide - Fantasy Grounds Customer Portal - Fantasy Grounds (https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644285/Developer+Guide)
Mephisto
August 17th, 2025, 17:41
I'm using ChatGPT quite frequently with very good results but you should have an understanding of programming and you should go step by step, creating one function a time. It also helps to start with existing code like the 5E ruleset. Additionally, you can upload a zip of the CoreRPG to a chat and ask ChatGPT to remember it. This will help ChatGPT to make cross-references to what you program and how it interactions with CoreRPG.
You can also copy code to a chat and ask ChatGPT to explain it, which gives you valuable insights.
Milke
August 17th, 2025, 19:12
I've moved this post to "The Workshop" sub-forum. This is the best place to ask questions about coding extensions in FG.
Thanks, Tren
Milke
August 17th, 2025, 19:17
I'm using ChatGPT quite frequently with very good results but you should have an understanding of programming and you should go step by step, creating one function a time. It also helps to start with existing code like the 5E ruleset. Additionally, you can upload a zip of the CoreRPG to a chat and ask ChatGPT to remember it. This will help ChatGPT to make cross-references to what you program and how it interactions with CoreRPG.
You can also copy code to a chat and ask ChatGPT to explain it, which gives you valuable insights.
How do I do that. Is it in the files on my computer? That CoreRPG.pak file? I can try to get ChatGPT to learn that. It might help. The number of times GPT has came back with "Ah! I see what the problem is now. I fixed it" (it didn't get fixed) is exhausting.
I guess i could get a book on the coding or try to figure it out. I have a degree (from quite a while back) in HTML programming. But, sheesh... what with work, and mowing the lawn, and playing Warhammer40k, and mowing my mom's lawn... you get the idea. I was just trying to take a shortcut. But it seems like the "shortcut" is taking longer than just figuring it out myself =p
*I can't seem to figure out how to extract the code from the CoreRPG.pak file anyway. 7-zip just keeps giving me the same file. Every source I look up (even on these boards) says "It's easy. Just rename it to .zip and use 7-zip to get the files". But this doesn't work.
LordEntrails
August 17th, 2025, 20:22
yes, corerpg.pak is just a renamed zip file. Copy it to a different folder (not the FG rulesets folder!), rename it and extract it. You can use Windows to unzip it as well. 7-zip should work I used to use it.
Milke
August 17th, 2025, 20:47
What I had to do (7-zip just kept giving me another .pak file) was instead of extracting files, I had to choose Open Archive, then manually drag each file over to my files folder.
LordEntrails
August 17th, 2025, 23:18
Thanks for letting us know the solution :)
Mephisto
August 18th, 2025, 23:36
For uploading it to ChatGPT, replace ".pak" with ".zip" and drag the zip file into the ChatGPT chat. The request to emorize the attached file. That's it.
Milke
August 22nd, 2025, 23:53
Well, it turns out to be all for naught. I got the files extracted. I uploaded about half of the CoreRPG to ChatGPT to help it learn how to code for Fantasy Grounds. It never gave me a working extension. Neither did Claude. And neither has CoPilot. For 6 days I've been getting extensions that load, and then do nothing else. And about 76 times, I've gone back and told the a.i. the extensions doesn't even begin to work, and I get a message that says, "You're sure right. I've narrowed down the problem. Here's an extensions that ABSOLUTELY WILL WORK AND IS BULLETPROOF." (Spoiler: It also doesn't work)
I guess I don't have to worry about a.i. taking over the workd anytime soon. I can't even get an extension that works. (This wasn't an extension that I really needed or was complex at all. The entire purpose was to see if a.i. could design an extension. It can't.)
But I appreciate all the comments. And thank you guys, as always.
MrDDT
August 23rd, 2025, 10:49
Well, it turns out to be all for naught. I got the files extracted. I uploaded about half of the CoreRPG to ChatGPT to help it learn how to code for Fantasy Grounds. It never gave me a working extension. Neither did Claude. And neither has CoPilot. For 6 days I've been getting extensions that load, and then do nothing else. And about 76 times, I've gone back and told the a.i. the extensions doesn't even begin to work, and I get a message that says, "You're sure right. I've narrowed down the problem. Here's an extensions that ABSOLUTELY WILL WORK AND IS BULLETPROOF." (Spoiler: It also doesn't work)
I guess I don't have to worry about a.i. taking over the workd anytime soon. I can't even get an extension that works. (This wasn't an extension that I really needed or was complex at all. The entire purpose was to see if a.i. could design an extension. It can't.)
But I appreciate all the comments. And thank you guys, as always.
Did you show it a working simple ext?
Milke
August 23rd, 2025, 21:11
Did you show it a working simple ext?
Yes. I picked out a pretty low intensity extension to show it how they are put together. The a.i. just can't seem to understand it.
SieferSeesSomething
August 24th, 2025, 19:57
On the positive side, as a programmer for my career, this thread helps me feel better about keeping my job lol.
zarlor
September 15th, 2025, 17:31
Yeah, "vibe coding" with AI is... tricky. As a non-coder myself (well, other than things like bash scripting) I've been working an extension layered onto XCore and I may eventually try to do a full ruleset. I've made progress but a big part has been figuring out better ways to get the process to work in a way that gives me something useful. Breaking it down into small steps is a HUGE part of that!
Essentially I've been using Gemini CLI to do the coding, you should be able to do similar with any of the agents like Claude CLI and the like, but Gemini makes it pretty much free, so... That I give access to to the extension directory I want to build and I ha unpacked CoreRPG and XCore as directories it could read to determine how the code works, I also had downloaded the pages from the Developers Guide and I set it up to use the context7 MCP (to better handle lua syntax which seems to work fairly well at some of the more egregious syntax issues it sometimes had.) However I don't stop there, I use Google's AI Studio (or you could use ChatGTP or Co-Pilot or whatever you want with a good thinking model) as a metaprompter/director. So my CLI agent is like the Engineer coding from prompts I get created from the metaprompter. Lately I've gotten even crazier and added spec-kit into the process (that is even better at breaking down a project into smaller pieces for us to work on) and I've set-up Onyx.app to act as a RAG implementation (using onyx-mcp-server so Gemini CLI can use it through an MCP call) where I can put things like the CoreRPG and XCore god and the developer guide and the like so I can use RAG to grab relevant information. That adds a cost in that you then need an API call to the AI you want to use, or you can set one up locally (like in LM Studio) but most likely you'll need to do that on a separate computer you can connect to, preferably with a good graphics card. I'm only just started to test the RAG configuration, though.
This does take some further prep in making sure you use the GEMINI.md file to set a good system prompt for the agent, and a good set of system instructions for the metaprompter and I'm working on a whole thing to kind of document this. It's still early stages of narrowing down to a method that works better (and there are new things coming out all the time, so...) so I can share some of that if folks like, but essentially the workflow is, as a kind of example (of note the below wouldn't work for me right now because I don't have the 5e ruleset in Onyx, but you should be able to get the idea), and note there is a lot of back and forth not shown in this, particularly for testing (where I use /console to get a console log, I also often make comments as I test in chat and I copy/paste that session from the chat log to the Engineer, that way it can see the logs and my comments and what showed in chat to troubleshoot issues):
- - Problem:** Implementing a new character sheet field that tracks a custom "Sanity" resource.
1. **User (`PM`) to Director:** The user begins the process by telling the Director what needs to be built.
- `User (to AI Studio):` "We need to create a new FGU extension that adds a 'Sanity' resource to the D&D 5E ruleset's character sheet. The field needs to be editable, and its value should be saved with the character data."
2. **Director to Engineer (Phase 1: `/specify`)**
The Director, following its protocol, analyzes the request and provides the explicit `spec-kit` prompt for the Engineer Agent.
- `Director (AI Studio):`
```
/specify
You have been tasked with creating a detailed specification for a Fantasy Grounds Unity extension. The extension will add a new, savable 'Sanity' field to the character sheet. Generate the `spec.md` file, defining the "what" and "why." The output must be in a Markdown code block.
```
- **Why this works:** The Director enforces the `/specify` gate, preventing the Engineer from writing code before a clear plan is in place.[8]
3. **Engineer to Director (Phase 2: `/plan`)**
The Engineer generates the `spec.md` using the `spec-kit` tool. The user (PM) reviews and approves it. The Director then issues the next `spec-kit` command, instructing the Engineer to first perform research using its tools.
- `Director (AI Studio):`
```
/plan
The specification for the Sanity field has been approved. The FGU Lua API uses `SubWindow` and `Field` objects to manage character sheet data. Your plan must use this architecture. Before proposing a plan, you must use your `onyx-mcp-server` to search for documentation on `Field` and `SubWindow` objects in the `FGU API Documentation` document set. Generate the `plan.md` file.
```
- **Why this works:** The Director's instruction forces the Engineer to use the `onyx.app` knowledge base via the `onyx-mcp-server` add-on. This ensures the Engineer doesn't hallucinate or guess at a solution, as was seen in the prior chat log. The prior chat log's issue of agents acting on flawed assumptions is directly addressed by this requirement for external, verifiable knowledge.[14]
4. **Engineer's Internal Reasoning**
The Engineer Agent, using its `GEMINI.md` protocols, would execute the following steps:
- It would use the `search_onyx` tool to query its knowledge base for documentation on `FGU Field objects` and `SubWindow` objects.[21]
- It would then generate a `plan.md` that references the retrieved documentation, outlining the steps to create a new `SubWindow` and a `StringField` within it, thereby grounding the plan in verifiable knowledge.
5. **Director to Engineer (Phase 3: `/tasks`)**
The user (PM) approves the plan, and the Director provides the final task breakdown command.
- `Director (AI Studio):`
```
/tasks
The plan for the Sanity field has been approved. Break down the plan into a granular list of actionable tasks. Your output must be a detailed `tasks.md` file in a Markdown code block.
```
- **Why this works:** This is the `spec-kit` command to begin the breakdown of the plan into manageable, auditable tasks.[7, 9] This prevents a monolithic code generation that is prone to errors and hard to debug.
6. **Implementation and Code Audit**
The Engineer, guided by its protocol, would then work on each task one at a time. The system's robustness is demonstrated here.
- `Engineer (Gemini CLI):` After generating code for a task, it would use the `Code Interpreter` tool to run unit tests and report the results.[22, 23]
- **Judge Agent (`FGU Code Auditor`):** If a bug or ambiguity arises or the tests fail, the user can invoke the Judge Agent. The Judge, configured as a separate Assistant in `onyx.app`, would then be instructed by the PM (or Director) to audit the code. The Judge, with RAG access to the underlying CoreRPG and XCore ruleset code, would review the new code and the test logs, providing an objective analysis and flagging any potential architectural flaws before the code is merged. This prevents overconfidence and provides a critical layer of oversight.
Hopefully that gives a few idea for folks on some potentially better ways to do some of these things as a non-coder. It's kind of a slow process, but at least it's an easily multi-tasked one (you get the prompt, give it to the agent, then go do something else while it does it's thing, come back copy the directory over to your FGU folder, test, give the response and then give all of those responses you put into the agent over to the metaprompter so it sees you testing and everything the agent did to come up with the next prompt to give to the agent... feel free to question the metaprompter a lot, too, AI makes a LOT of assumptions and this whole process is about trying to tamp some of those down and try to prevent too many hallucinations.)
LordEntrails
September 15th, 2025, 20:20
I'm a proponent of machine learning, generative creation, and AI in general. But unless you are going to be developing FG full-time, it seems to me that it would be much more efficient and certainly easier to learn how to hand code FG than to learn, setup, train, and develop all of these AI tools to get them to be able to create an extension or ruleset for you.
FG is really not all that hard to learn (especially with all the newer templates and standardization) especially if you are competent enough to be setting up MCPs, CLI Agents and configuring API calls.
That said, if you are doing it for fun (which for most of us FG should be) then do whatever bring you the most fun!
zarlor
September 16th, 2025, 00:02
Well, the coding might not be that hard, per se, but tracking all of the variables and their workflow through many, many, many files that seem to call them all to find exactly how what you were working on fits with all of the knock-on effects IS rather hard, to be honest. For me that's at least one spot where genAI has the potential to shine.
As for the tools, well, I have a lot of other reasons for training myself up on not just GenAI but also the tools that are out there, how they can be used, etc. So, yeah, my doing this now is pretty involved, but it's the folks out there finding how to make these tools work together to do all of these things that then make it all easier for everyone else later that really make it worth the effort. So it's definitely worth it for me, and hey, if I stumble upon the right tools in the right combo it may well make it all a lot easier for a lot more folks in the future to find the quick way to set it all up and then just go with it. Let's face it there are for more requests out there for functionality and rulesets and such to be added to FGU than there are folks who've spent the time and effort to learn to code and learned to code lua and learned to code for FGU, so anything that could extend those functions into more and more hands seems like it would be worthwhile to me.
LordEntrails
September 16th, 2025, 02:31
Well, the coding might not be that hard, per se, but tracking all of the variables and their workflow through many, many, many files that seem to call them all to find exactly how what you were working on fits with all of the knock-on effects IS rather hard, to be honest. For me that's at least one spot where genAI has the potential to shine.
Yep, its one of the uses of AI the devs at my work use it for. They also use it to generate flow diagrams and check for logic flaws by evaluating those diagrams.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.