STAR TREK 2d20
  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
    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 Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  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)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in