View Full Version : FG/FGU, Interface.dialogFileSave() is different ?
deff
July 11th, 2020, 08:54
Hello,
in FGC, i use this :
local sFile = Interface.dialogFileSave();
ChatManager.SystemMessage(sFile);
and it works great.
In FGU, for the same code i have this error :
Script execution error: [string "scripts/manager_stats_extension.lua"]:105: dialogFileSave: Invalid parameter 1
Looking at the API : https://www.fantasygrounds.com/refdoc/Interface.xcp#dialogFileSave, both arguments are optionnal, so i do not understand the error...
Do you have an example on how works this method in unity ?
Thanks a lot.
Cheers.
celestian
July 11th, 2020, 09:01
The FGU version uses a callback method that FGC does not. Interface.dialogMessage() also was changed similarly.
Here is how I do it for saving out npcs (which will be redundant in 3.3.11 CoreRPG)... but you can see how it works.
--[[
REMOVE onInit/exportNPC/onExportFileSelection WHEN CoreRPG 3.3.11 is released
]]
function onInit()
CampaignDataManager.onExportFileSelection = onExportFileSelection;
end
function exportNPC()
CampaignDataManager.sExportRecordPath = "npc";
--if UtilityManager.isClientFGU() then
if UtilityManagerADND.isFGU() then
Interface.dialogFileSave(onExportFileSelection);
else
local sFile = Interface.dialogFileSave();
if sFile then
onExportFileSelection("ok", sFile);
end
end
end
function onExportFileSelection(result, path)
if result ~= "ok" then return; end;
if CampaignDataManager.sExportRecordPath and CampaignDataManager.sExportRecordPath == "npc" then
DB.export(path, "npc", "npc", true);
ChatManager.SystemMessage(Interface.getString("message_slashexportsuccess"));
elseif (sExportRecordPath or "") ~= "" then
DB.export(path, sExportRecordPath, "character");
ChatManager.SystemMessage(Interface.getString("message_slashexportsuccess") .. ": " .. DB.getValue(DB.getPath(sExportRecordPath, "name"), ""));
else
DB.export(path, "charsheet", "character", true);
ChatManager.SystemMessage(Interface.getString("message_slashexportsuccess"));
end
end
deff
July 11th, 2020, 09:27
Thanks a lot, i will try this :)
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.