Starfinder Playlist
Page 1 of 4 123 ... Last
  1. #1

    How to include portraits in chat.

    In order not to threadjack another thread, it was asked how to include the player portait in the chat.

    This involves a simple modification to the chat_entry.lua file in your [ruleset]/scripts folder. If you want to do this to the default ruleset you will need to create a cusom version by extracting the d20.pak file and placings in the ruleset directory and rename it to something like myd20.

    Replace this function:
    Code:
    function onDeliverMessage(messagedata, mode)
    	if User.isHost() then
    		gmid, isgm = GmIdentityManager.getCurrent();
    
    		if messagedata.hasdice then
    			messagedata.sender = gmid;
    			messagedata.font = "systemfont";
    		elseif mode == "chat" then
    			messagedata.sender = gmid;
    			
    			if isgm then
    				messagedata.font = "dmfont";
    			else
    				messagedata.font = "npcchatfont";
    			end
    		elseif mode == "story" then
    			messagedata.sender = "";
    			messagedata.font = "narratorfont";
    		elseif mode == "emote" then
    			messagedata.text = gmid .. " " .. messagedata.text;
    			messagedata.sender = "";
    			messagedata.font = "emotefont";
    		end
    	end
    	
    	return messagedata;
    end
    with this:
    Code:
    function onDeliverMessage(messagedata, mode)
    	if User.isHost() then
    		gmid, isgm = GmIdentityManager.getCurrent();
    
    		if messagedata.hasdice then
    			messagedata.sender = gmid;
    			messagedata.font = "systemfont";
    		elseif mode == "chat" then
    			messagedata.sender = gmid;
    			
    			if isgm then
    				messagedata.font = "dmfont";
    			else
    				messagedata.font = "npcchatfont";
    			end
    		elseif mode == "story" then
    			messagedata.sender = "";
    			messagedata.font = "narratorfont";
    		elseif mode == "emote" then
    			messagedata.text = gmid .. " " .. messagedata.text;
    			messagedata.sender = "";
    			messagedata.font = "emotefont";
    		end
    	else
    		messagedata.icon = "portrait_" .. User.getCurrentIdentity() .. "_charlist";
    	end
    	
    	return messagedata;
    end

    The only real issue with this is the potraits themselves are rather large. I am trying to think of an automatic way around this but the hacky way would be in your graphic.xml file just create links to already resized portraits for your current characters and modify the above code to call that instead.

    Screenshot is a link below (due to size):
    https://www.ptolus-fg.com/images/screenshot01.png

  2. #2
    Quote Originally Posted by joshuha
    The only real issue with this is the potraits themselves are rather large. I am trying to think of an automatic way around this but the hacky way would be in your graphic.xml file just create links to already resized portraits for your current characters and modify the above code to call that instead.
    Found it!
    For small portraits change the _charlist to _miniportrait and you are all set. These are 16x16.

    For more medium size change the _charlist to _token. These are 30x30.
    The _charlist ones I believe are 72x72 including the frame which takes up a lot of the chatbox.
    Last edited by joshuha; June 12th, 2007 at 03:14.

  3. #3
    Here we go!
    Thanks a lot, It works like a charm
    Always keep it in perspective!

  4. #4
    An idea I was playing around with when I was adding the same thing to my ruleset was making the portraits showing up a user specific setting, so that if you prefer to not have portraits show up in your chat window, you could turn it off.

    .. unfortunately, I couldn't find a way to modify the incoming message. OnReceiveMessage only gets a local copy of the message data, and any modifications it does aren't processed.

    I did try a version where OnReceiveMessage called AddMessage and then returned true (which stopped the default handling of it), which sorta worked, but it wasn't as clean as it should have been...
    "He is everything I have ever aspired to be."
    "Your aspiration is to be impaled on a halberd? Your parents must be proud."

  5. #5
    Both of you - awesome, I stole this script as soon as I saw it. Great work thanks!

  6. #6
    Has anyone that used this lost the ability to make /die 1dwhatever command??
    Question: How does an Assamite find herself between a 12ft murder machine and a high place?

    Answer: When she's running away from a werewolf in Crinos and she has to jump onto a fire escape with the Phobia: High Places flaw

  7. #7
    Doswelk's Avatar
    Join Date
    Jul 2005
    Location
    Surrey, UK
    Posts
    2,681
    Quote Originally Posted by ldyparadox99
    Has anyone that used this lost the ability to make /die 1dwhatever command??
    No seems to work still for me

  8. #8
    Interesting because I added the portraits the other night and lost /die and /w functions. Had to go back and replace it so we could play our session.

    I'll have to try again for this coming week.
    Question: How does an Assamite find herself between a 12ft murder machine and a high place?

    Answer: When she's running away from a werewolf in Crinos and she has to jump onto a fire escape with the Phobia: High Places flaw

  9. #9
    That's strange. I can't seem to find the files mentioned. Is this for FGI or FGII? Any chance for a bit more of a walk-through? I mean, I looked in the Ruleset section and searched for a chat_entry.lua file everywhere...

  10. #10
    It's for FG2 and the file you're looking for is actually a .lua file which is a script.

    Look in your rule set file for another file named scripts...you'll find it there.
    Question: How does an Assamite find herself between a 12ft murder machine and a high place?

    Answer: When she's running away from a werewolf in Crinos and she has to jump onto a fire escape with the Phobia: High Places flaw

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
  •  
DICE PACKS BUNDLE

Log in

Log in