PDA

View Full Version : Extension to write back to chat window



JimSocks
July 8th, 2025, 04:31
Hello,

I am developing an extension, but running into roadblocks left and right with the chat window. I can send a message out of FG to a python bridge I have running, by having it constantly read the database file looking for outbound comms. That works ok.

But I would like it to respond, and I can't figure out how to get the response back into the chat window.

I am using slash commands both to send the message out, and to try to retrieve it. The sending is working, but retrieving is stopping me cold. I have tried writing to the database (no joy, it's locked when FG is running), I have tried writing to an external file within the FG directory and reading from that file too, without success.

Is there a way?

Moon Wizard
July 8th, 2025, 04:38
There is no "interface" to write from external applications into FG. External interactions are limited to HTTP/S requests which can receive a string response.

Regards,
JPG

jharp
July 8th, 2025, 06:22
Write to a file in the campaign folder and have the mod read it once in a while. Post data from read into chat log.

This does work. If you are having issues, maybe you need to close the file from the external app before fg reading. I read all sorts of data from external files in my mods.

Jason

jharp
July 8th, 2025, 06:27
There is no "interface" to write from external applications into FG. External interactions are limited to HTTP/S requests which can receive a string response.

Regards,
JPG

If this is correct that a string response is returnable then use that to return a tempnam filename that will be read.

Jason

Moon Wizard
July 8th, 2025, 08:27
If all that is needed is a string response from a HTTP request; no reason to write to file, just use the string directly in your script.

Regards,
JPG

jharp
July 9th, 2025, 00:35
It sounds that this is a request with delayed response system you want to build.

You could also this....

1. Make a request to the python bridge (i assume the response is not immediately available), it immediately returns a requestID. (Security might be concern but I ignore that)
2. In a loop in the mod in fg, make a request for response (providing the requestID). This either returns the data as previously requested, or a status condition.
3. Repeat until status is either what you want or is failed.

Jason