PDA

View Full Version : Does FG deal with sytem variables?



Alynn
May 24th, 2023, 17:08
So I have a big project that I am working on that has 3 major components. a FGU extension is the last one I need to make, then I can fold all of them together into one working ecosystem.

I've read over some tutorials, and I have a good idea of what I need to do.

However, I have one question about filesystem locations (for example DB.export) can I use can I use os.getEnv to pull the home directory or can I use system variables like %localappdata%\Exports for my default value.



The idea here is there will be a text box that can be edited to specify where we are exporting our character data and combat tracker data from the database.

Thats all I need this extension to do, as the local server then does all the operations from there after it detects the files were updated.

Lastly, is stringfield my best option for this when I register the option?

pindercarl
May 24th, 2023, 17:48
You may want to look at the API function dialogFileSave. This should pop-up a file save dialog box. You can find sample usage in CoreRPG if you search for the function name. For example, from manager_campaigndata.lua:


function exportChar(nodeChar)
sExportRecordType = "charsheet";
if nodeChar then
sExportRecordPath = DB.getPath(nodeChar);
else
sExportRecordPath = "";
end
if UtilityManager.isClientFGU() then
Interface.dialogFileSave(CampaignDataManager.onExp ortFileSelection);
else
local sFile = Interface.dialogFileSave();
if sFile then
CampaignDataManager.onExportFileSelection("ok", sFile);
end
end
end

Alynn
May 25th, 2023, 01:35
Thanks for that.

I found the File.openTextFile and the get functions for the data and campaign folders so that will do what I want.

Tomorrow I will finish up with the handler callback function for when that value is changed.