Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
mudlet:chat_capture_window [2021/07/11 20:30] – Adding copy/pasteable LUA code. paradoxmudlet:chat_capture_window [2023/11/05 22:08] – [Advanced: Adding Timestamps] math
Line 1: Line 1:
 ====== Chat Capture Window Mudlet Script ====== ====== Chat Capture Window Mudlet Script ======
-  Open the "scripts" setting page and create a new one.  Copy in the following source code.<code>+ 
 +Let's walk through setting up Mudlet to separate channel output for ''[chat]'' in its own window so it won't be lost with combat spam. 
 + 
 +===== Create a Window Script ===== 
 + 
 +  - Connect to the MUD with your existing Mudlet profile 
 +  Click the "scripts" button in the toolbar 
 +  - Click the "add item" button to create a new script. 
 +  - Enter a name, like //"Chat Capture Window"// 
 +  - In //"Add User Event Handler:"// enter: <code>sysConnectionEvnet</code> 
 +  - Click the "+" button. 
 +  - Copy in the following source code to the text area.<code>
 function make_chat_window() function make_chat_window()
   chat_window = Geyser.UserWindow:new({   chat_window = Geyser.UserWindow:new({
Line 8: Line 19:
     height = "5c",     height = "5c",
     dockPosition = "top",     dockPosition = "top",
 +    autoWrap = true,
   })   })
   chat_window:setFontSize(getFontSize())   chat_window:setFontSize(getFontSize())
Line 16: Line 28:
 </code> </code>
   - Your scripts setting pages should now look exactly like this: {{mudlet:screen_shot_2021-03-29_at_6.14.32_pm.png}}   - Your scripts setting pages should now look exactly like this: {{mudlet:screen_shot_2021-03-29_at_6.14.32_pm.png}}
-  - Open the "triggers" setting page and create new onecopying in the following code: <code>+  - Click the "Save Item" button 
 + 
 +===== Create a [chat] Capture Trigger ===== 
 + 
 +  - Click the "triggers" button in the toolbar (or the lefthand menu of the scripts page if you still have that open). 
 +  - Click the "add item" button. 
 +  - Give your trigger name like //"Chat Capture"//. 
 +  - In the first pattern, enter a channel name as it appears in game: <code>[chat]</code> 
 +  - Leave everything else empty. 
 +  - Copy in the following code to the textarea: <code>
   if(chat_window)   if(chat_window)
   then   then
Line 25: Line 46:
 </code> </code>
   - Your triggers settings page should now look exactly like this: {{mudlet:screen_shot_2021-03-29_at_6.14.53_pm.png}}   - Your triggers settings page should now look exactly like this: {{mudlet:screen_shot_2021-03-29_at_6.14.53_pm.png}}
 +  - Click save item.
   - You may need to reconnect to the MUD to get the window to appear.    - You may need to reconnect to the MUD to get the window to appear. 
-  - Add other patterns to the trigger for other channels as desired.+ 
 +===== Advanced: Adding Timestamps ===== 
 + 
 +To add timestamps to your chat capture window, replace 
 +<code> 
 +copy() 
 +chat_window:appendBuffer() 
 +</code> 
 +in the previous examples with 
 +<code> 
 +echo("chat_window", string.format("%s: %s\n", getTime(true), getSelection()) 
 +</code> 
 +Check the Mudlet Lua documentation to see more formatting options for getTime(). 
 + 
 +===== Capture Additional Channels ===== 
 + 
 +To capture additional channels to the same window simply add more capture patterns to the trigger. 
 + 
 +===== Styling the Capture Window ===== 
 + 
 +Here's an example of adding additional styling to the chat capture window. 
 + 
 +**NOTE: Requires Mudlet 4.10+ and Linux - will not work on older Mudlet or MacOS/Windows** 
 + 
 +  - Open the "scripts" page again by clicking the button in the toolbar. 
 +  - Change your "Chat Capture Window" script (or whatever you named it!) to add a ''chat_window:setStyleSheet'' fragment:<code> 
 +  chat_window = Geyser.UserWindow:new({ 
 +    name = "chat_window", 
 +    titleText = "CHATS", 
 +    docked = true, 
 +    height = "5c", 
 +    dockPosition = "top", 
 +  }) 
 + 
 +  chat_window:setStyleSheet([[ 
 +    background-color: black; 
 +    border-width: 2px; 
 +    border-color: #005c28; 
 +    border-style: groove; 
 +    border-radius: 2; 
 +  ]]) 
 + 
 +  chat_window:setFontSize(getFontSize()) 
 +  return 1 
 +end 
 + 
 +make_chat_window() 
 +</code>