5E Product Walkthrough Playlist
  1. #1

    FG/FGU, Interface.dialogFileSave() is different ?

    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/refdo...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.

  2. #2
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,787
    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.

    Code:
    --[[
    
    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
    ---
    Fantasy Grounds AD&D Content Bundle (All The AD&D Content)
    Coding the Official AD&D Ruleset
    Documentation for AD&D 2E ruleset.
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)

  3. #3
    Thanks a lot, i will try this

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DMsGuild Classic

Log in

Log in