Scripting thread (Mudlet chatbox inside)

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

Scripting thread (Mudlet chatbox inside)

Post by Heron » Thu Jun 17, 2021 12:02 pm

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: 25
Joined: Tue May 18, 2021 12:00 pm

Re: Scripting thread (Mudlet chatbox inside)

Post by Heron » Thu Jun 17, 2021 1:00 pm

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.

nobody
Posts: 361
Joined: Wed Jun 17, 2020 7:43 am
Contact:

Re: Scripting thread (Mudlet chatbox inside)

Post by nobody » Thu Jun 17, 2021 1:32 pm

Heron wrote:
Thu Jun 17, 2021 1:00 pm
This 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: 1
Joined: Fri Sep 10, 2021 2:32 pm

Re: Scripting thread (Mudlet chatbox inside)

Post by alistair » Sun Sep 12, 2021 4:25 am

Thanks! Works like a charm :)

Post Reply