Scripting thread (Mudlet chatbox inside)

If the topic doesn't fit anywhere else, discuss it here.
Post Reply
Heron
Posts: 29
Joined: Tue May 18, 2021 12:00 pm

Scripting thread (Mudlet chatbox inside)

Post by Heron »

To make an easy chatbox, open mudlet's scripts section and click add item.
Name and then paste this into the newborn script file:

createMiniConsole("chat", 800,0,550,200)
setBackgroundColor("chat",0,0,0,255)
setMiniConsoleFontSize("chat", 8)
setWindowWrap("chat", 70)

You may need to fiddle with the configurations before you're happy with them, but these are the ones that work for me.

Now go to the triggers tab, and make a new one. Name it something appropriate, like 'Chat capture'. You can fill it out like so:
https://i.imgur.com/u1VUjg0.png (Link instead of image because img tags give me the error: 'Your images may only be up to 1 pixels high.')

But keep in mind that if you make the box red (start of line) it'll run imperceptible milliseconds faster but you have to get the spacing right. It is perfectly safe to leave the box black (substring).

For your convenience, the thing you want to paste into the scripts box is right here:

selectCurrentLine();
copy();
appendBuffer("chat")

You now have a chatbox! Here's a quick blurb on what all these functions do. By the way, mudlet functions are case sensitive. You may need to restart mudlet since miniconsoles can occasionally fail to shift until you do. It's pretty reliable most of the time though.

createMiniConsole("chat", 800,0,550,200) makes a miniconsole, or in this case chatbox. The things inside the parentheses are, in this order: (name, x, y, width, height). Ours is named 'chat' so all functions that write to or modify the 'chat' miniconsole will modify this bad boy here. Some people have a lot of miniconsoles, so being able to name them is important. My chatbox is at 800 x and 0y, so it's on the top right of my screen. You may wish to move yours elsewhere, in which case fiddle with the numbers until you're happy. Likewise, width and height determine how much real estate the console takes up.

setBackgroundColor("chat",0,0,0,255) determines the console color. Mine is black, so it blends in with the mudlet background. I've run red boxes and whatever before. Play with the numbers until you're happy. I think it's (name, R,G,B, brightness/saturation/whatever) or something. I like a black box.

setMiniConsoleFontSize("chat", 8) sets your font size. Since my box is smaller, I keep my font smaller than my main terminal's text. Again, this is up to you. Play with it until you're happy.

setWindowWrap("chat", 70) This sets the wrap of your box. Much like how the text in your main terminal doesn't go from the far left of your screen all the way to the right before starting a new line, this sets the cutoff. In the olden days, muds liked to set this at 80. We have bigger screens now, but my chatbox is small, so I set mine at 70.


On the trigger front:
selectCurrentLine();
copy();
appendBuffer("chat")

This is much simpler. Line 1 selects line that set off the trigger. Line 2 saves it to your buffer. Line 3 outputs it to the chatbox of your choice. In our situation, this is 'chat.'

And there you go.

Let's see if we can't drum up some scripting interest here.
Heron
Posts: 29
Joined: Tue May 18, 2021 12:00 pm

Re: Scripting thread (Mudlet chatbox inside)

Post by Heron »

How to do sound:

You can futz with the Mudlet UI to beep you if you have the sound file, but I imagine many of us don't just keep random sound clips lying around. This was one of my greatest annoyances, since I didn't want to sift through a billion sounds ripped from some sketchy site.

Fortunately, Mudlet has a stand-in: the TTS (Text to speech) system. This was implemented to help VI players with accessibility, BUT it also helps us lazy, sighted players... With chat notifications!

Simply append:
ttsSpeak("a")

To the scriptbox of a trigger of your choice, like the chatbox described in the post above. When something activates this trigger, Mudlet will say 'a.'

Unfortunately, sounds are more resource-intensive than most things and can occasionally lag.
User avatar
nobody
Posts: 501
Joined: Wed Jun 17, 2020 7:43 am
Contact:

Re: Scripting thread (Mudlet chatbox inside)

Post by nobody »

Heron wrote: Thu Jun 17, 2021 1:00 pmThis was one of my greatest annoyances, since I didn't want to sift through a billion sounds ripped from some sketchy site.
My favorite sketchy website for sound effects is the BBC's sound effect library. It's not quite a billion, but it is several thousand and mostly less sketchy. Mostly.
alistair
Posts: 2
Joined: Fri Sep 10, 2021 2:32 pm

Re: Scripting thread (Mudlet chatbox inside)

Post by alistair »

Thanks! Works like a charm :)
notgreg
Posts: 26
Joined: Thu Sep 23, 2021 10:04 pm

Re: Scripting thread (Mudlet chatbox inside)

Post by notgreg »

This is super helpful! Is there some way to gag them from the main window so they only show in the chatbox?

If you can't tell, I have absolutely zero scripting knowledge.

I'm also curious if anyone has set up any roundtime/travel time gauges? I feel like an RT gauge would make me so happy.
User avatar
Rias
DEV
Posts: 2024
Joined: Sun Sep 03, 2017 4:06 pm
Location: Wandering Temicotli

Re: Scripting thread (Mudlet chatbox inside)

Post by Rias »

notgreg wrote: Thu Sep 23, 2021 10:06 pm Is there some way to gag them from the main window so they only show in the chatbox?
In your trigger, after the appendBuffer do:

Code: Select all

deleteLine()
moveCursor(0,getLineNumber()-1)
deleteLine() 
That'll delete the line (and the blank line after it) from the main window so it only shows in the chat window.
<Rias> PUT ON PANTS
<Fellborn> NO
Post Reply