DICE PACKS BUNDLE
Page 6 of 8 First ... 45678 Last
  1. #51
    Hi there. Extension doesn't seem to be working with the Mongoose Traveller 2nd Edition ruleset. It looks like it create the temp image fine (in the campaign portraits folder I see a dummy_portrait_reference-npcdata-name-module, which if I add a .png extension I can view in an image editor), but no image shows in the chat window. I notice without the extension loaded, I get the Imperial Sunburst.

    Running on FGU Ultimate 4.3.2, Windows 11. New user to FG, long time Software Developer. Lua is not my strongest language. Let me know if you need any other info.

  2. #52
    Hello, forgive me for not being able to work this out myself; if I, as GM, talk in the chat as an NPC, will it show the PC's the portrait then?

    Update: Ignore me. Wasn't working before because I was an idiot, but it works now!
    Last edited by WinterSoldier7; February 19th, 2023 at 19:57.

  3. #53

  4. #54
    Quote Originally Posted by MostTornBrain View Post
    I was fiddling with the github code for this extension, and I think I have a solution for handling portraits when chatting in languages.

    If you add the following to the onDesktopInit() function:
    Code:
        if User.isHost() then
            origCommDeliverOOBMesssage = Comm.deliverOOBMessage;
            Comm.deliverOOBMessage = myDeliverOOBMessage;
        end
    And then add this new function, it should display the character portraits for language chat.
    Code:
    function myDeliverOOBMessage(msg, extra)
        if (msg.type == LanguageManager.OOB_MSGTYPE_LANGCHAT) then
            insertPortraitToMessage(msg, extra);
        end
        origCommDeliverOOBMesssage(msg, extra);
    end
    The challenge was the LanguageManager registers a callback for the ChatManager DeliverMessageCallback and it takes precedence over any callback added by an extension, so the portrait insertion had to be handled afterwards. The LanguageManager calls Comm.deliverOOBMessage after it does the "translation" of a language chat message, so we need to intercept that call, insert the portrait, and then call the real OOBMessage function.

    Also, for this work-around, the portrait should only be inserted if the message is originating on the GM host - if a real player is chatting in a language, the icon should already be correct and if the insertPortraitMessage() function were to be called by a player, it instead turns the icon into the GM's token.

    It all seems to work in my local testing, but I'd recommend more extensive testing in case I overlooked something.

    Cheers,
    Brian
    Hey Brian, thanks for your helpful reply! Can't believe it took me almost a year to see it. Unfortunately, I've no idea where to go to input that piece of code... Don't suppose you can help again?

    And if the extension author is watching, would be superb if you could incorporate this function into the default extension...

  5. #55
    I also completely missed the report of issues with the languages. I had my third baby around that time and moved internationally a few months after. Sorry about that, the fix is actually super easy and only took a few minutes. It is up on the Forge or available here if you prefer.

    I verified in 5e and SWD that it is working. Obviously I can't test every ruleset, but the language functionality is CoreRPG functionality, so what fixes one should fix most.

    Since there was some discussion about about how to fix in code, I like to keep things as simple as possible, so I just changed this:
    Code:
    function onDesktopInit()
        if User.isLocal() or User.isHost() then
            ChatManager.registerDeliverMessageCallback(insertNpcPortraits)
    To this:
    Code:
    function onDesktopInit()
        if User.isLocal() or User.isHost() then
    	ChatManager.unregisterDeliverMessageCallback(LanguageManager.onChatDeliverMessage);
            ChatManager.registerDeliverMessageCallback(insertNpcPortraits)
    	ChatManager.registerDeliverMessageCallback(LanguageManager.onChatDeliverMessage);
    ChatManager.registerDeliverMessageCallback inserts the callback in a table, so they are called in the order they are registered. The NPC portrait callback does not return true, so that it doesn't affect the processing of any callbacks that need to happen after it. So by just unregistering and re-registering the language callback, it just allows the messages to first have the portraits added, and then fall through to the language manager callback.
    Last edited by sirnoobsauce; March 29th, 2023 at 20:17. Reason: Updating after adding to Forge

  6. #56
    Quote Originally Posted by sirnoobsauce View Post
    I also completely missed the report of issues with the languages. I had my third baby around that time and moved internationally a few months after. Sorry about that, the fix is actually super easy and only took a few minutes. It is up on the Forge or available here if you prefer.

    I verified in 5e and SWD that it is working. Obviously I can't test every ruleset, but the language functionality is CoreRPG functionality, so what fixes one should fix most.

    Since there was some discussion about about how to fix in code, I like to keep things as simple as possible, so I just changed this:
    Code:
    function onDesktopInit()
        if User.isLocal() or User.isHost() then
            ChatManager.registerDeliverMessageCallback(insertNpcPortraits)
    To this:
    Code:
    function onDesktopInit()
        if User.isLocal() or User.isHost() then
    	ChatManager.unregisterDeliverMessageCallback(LanguageManager.onChatDeliverMessage);
            ChatManager.registerDeliverMessageCallback(insertNpcPortraits)
    	ChatManager.registerDeliverMessageCallback(LanguageManager.onChatDeliverMessage);
    ChatManager.registerDeliverMessageCallback inserts the callback in a table, so they are called in the order they are registered. The NPC portrait callback does not return true, so that it doesn't affect the processing of any callbacks that need to happen after it. So by just unregistering and re-registering the language callback, it just allows the messages to first have the portraits added, and then fall through to the language manager callback.
    JUST IN TIME FOR GAME NIGHT! YOU ABSOLUTE LEGEND!

    Running Session 01 of Out of the Abyss tonight, and language barriers is a big part of the first chapter! Thanks a bunch.

    Congrats on the baby!

  7. #57
    Thank you for this EXT, I wanted to report after the last update I'm getting this error from this EXT loaded.

    [ERROR] Handler error: [string "NPC_Portraits:scripts/npc_manager.lua"]:18: attempt to call field 'isLocal' (a nil value)

  8. #58
    Looks like all isLocal stuff got removed and you have to use Session.IsHost drop thru instead.

    I noticed using this that some NPCs tokens work and some do not.

  9. #59
    Quote Originally Posted by MrDDT View Post
    Thank you for this EXT, I wanted to report after the last update I'm getting this error from this EXT loaded.

    [ERROR] Handler error: [string "NPC_Portraits:scripts/npc_manager.lua"]:18: attempt to call field 'isLocal' (a nil value)
    Thanks for letting me know, it should be fixed now.

  10. #60
    Quote Originally Posted by sirnoobsauce View Post
    Thanks for letting me know, it should be fixed now.
    Thank you so much, I can confirm it's working and fixed up.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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
  •  
STAR TREK 2d20

Log in

Log in