STAR TREK 2d20
  1. #1

    Suggested change for CoreRPG manager_gmidentity.lua

    I found that while you can switch to any NPC identity (whether it already exists or not) by typing "/id <name>," there's no way to switch with a slash command back to the GM ID. If you use /gmid, it changes the name of the GM ID, but doesn't activate it. And if you type /id <your GM id here>, the UI gets into a borked state where it creates an ID with the same name as the GM ID and neither one of them work right. From there you have to reload in order to have IDs work right again.

    A small change to the id slash command handler function both fixes the bug and also allows you to use the /id command to activate the GM identity. I changed the function on line 18 of manager_gmidentity.lua as follows. Added code in blue:


    Code:
    function slashCommandHandlerId(sCommand, sParams)
        if not User.isHost() then
            return;
        end
        if string.upper(sParams) == string.upper(CampaignRegistry.gmidentity) then
            activateGMIdentity();
            return;
        else
            addIdentity(sParams, false);
        end
    end
    Thoughts?
    Last edited by cscase; September 22nd, 2013 at 02:03.

  2. #2

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    I'm getting the following:

    Script Error: [string "scripts/gm_id.lua"]:10: bad argument #1 to 'upper' (string expected, got nil)

    (I put your code into an extension, which is why the module has a different name.)

  3. #3

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    And here is the fixed version (my copy of gm_id.lua, which is installed as an extension so that I don't have to mess around with the CoreRPG ruleset).

    Code:
    -- Replacement for /id, allows use of /id gm
    function onInit()
        Comm.registerSlashHandler("identity", slashCommandHandlerId);
    end
    
    function slashCommandHandlerId(sCommand, sParams)
        if not User.isHost() then
            return;
        end
        local GMname = CampaignRegistry.gmidentity or "GM";
        if string.upper(sParams) == string.upper(GMname) then
            GmIdentityManager.activateGMIdentity();
        else
            GmIdentityManager.addIdentity(sParams, false);
        end
    end
    Last edited by Andraax; September 22nd, 2013 at 06:22.

  4. #4
    Aha, that campaign registry value is nil if no custom name has been set, I guess. I had one set at the time I tried this and didn't catch that! Thanks, Andraax!!
    Last edited by cscase; September 22nd, 2013 at 07:01.

  5. #5
    Got it in the queue for the next cycle.

    Thanks,
    JPG

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 Product Walkthrough Playlist

Log in

Log in