|
tekphnx Newbie
Joined: 21 Aug 2007 Posts: 6
|
Posted: Wed Aug 22, 2007 1:01 am
How to warn of buffer-breaking poses? |
Hi everyone,
I'm trying out cMud and really do like the client and am thinking about purchasing it. However, there's one feature I'm looking for that I haven't been able to find in this or any other client. I'm hoping that there's a way to do this, even if I have to write a plugin myself! If there's a way to do this, I'm sold. n.n
I do heavy freeform roleplay a lot and often write very long poses that sometimes break the maximum buffer that the MUCK can handle. I'd like for there to be some way that cMud would warn me that I'm going over a certain number of characters in my pose (I think the number is 8,000 in the Muck I play on), maybe beep at every character over the limit and/or turn the offending text red and not allow it to be posted? That way I can tailor my poses so that they don't get chopped short when I post to the MUCK? I'm suprised that I haven't been able to find anything on this, I know several people on the MUCK I play on who would love a feature like this.
I tried the "Bell Column" setting built into cMud, but it didn't seem to work, or did something other than what I was looking for.
Thank you much for your help. |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Wed Aug 22, 2007 1:19 am |
How about this?
Code: |
#CLASS Limit
#VAR Limit/limit 20
#ONINPUT {(*)} {#IF (%len(%1) > @Limit/limit) {
#NOINPUT
#INPUT {%1}
#SHOW {CMUD: Warning: input > @Limit/limit chars}
#COLOR red,hi
}
}
#CLASS 0 |
Set limit to whatever you want. The above is short for testing. |
|
|
|
tekphnx Newbie
Joined: 21 Aug 2007 Posts: 6
|
Posted: Wed Aug 22, 2007 1:41 am |
Oh, thank you for the quick reply! Sorry for being such a noob, but could you please tell me what kind of code this is and how to go about using it?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Aug 22, 2007 2:22 am |
Here's a slightly simpler version of the same script that should be functionally the same to make it easier to explain:
Code: |
#CLASS Limit
#VAR limit 20
#ONINPUT {(*)} {#IF (%len(%1) > @limit) {
#NOINPUT
#SHOW {<color red>CMUD: Warning: input > @limit chars</color>}
}
}
#CLASS 0 |
The "limit" variable controls the number of characters in your limit. The ONINPUT trigger that the #oninput command creates will fire on any input and test its length against the limit - if it's greater, the #noinput command will stop it from being sent to the MUD, and the #show command will display a coloured warning.
You could also have the script tell you how many characters you're over my changing the warning to "Input is (%len(%1)-@limit) characters too long" or something.
This isn't quite what you asked for, though - CMUD does include an option to tell you when your line length has reached a certain number (the "Bell Column" setting on the Command Line preferences page) but the number resets when the text wraps onto a new line. |
|
|
|
tekphnx Newbie
Joined: 21 Aug 2007 Posts: 6
|
Posted: Wed Aug 22, 2007 2:30 am |
Thank you! This code does seem cleaner and seems to make sense. But I still don't get how to actually USE the script! I'm very new to cMUD. Like, where do I put this bit of code, exactly? As a trigger, or... ? XD
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Aug 22, 2007 2:44 am |
I think what he really needs is for something to be added to the editor (CTRL-SHIFT-ENTER) window. I was playing around with it some and couldn't seem to get line or column numbers to appear. Those would at least let him stop at say 90 lines. I think that more then that though he want to be able to have a byte counter for the typing there.
I can't recall whether Zugg still planned any major additions to the editor, but I can see it would be good to have some further abilities. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Aug 22, 2007 2:46 am |
tekphnx wrote: |
where do I put this bit of code, exactly? As a trigger, or... ? |
Just copy everything that's in the Code box, paste it onto the command line and hit enter. The #var command will create the variable and the #oninput command will create the trigger - the #class commands will put them in their own folder. Once you've done that, it should Just Work. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Wed Aug 22, 2007 2:49 am |
Paste it right into your command line and hit <enter> and it will be created automagicly
|
|
|
|
tekphnx Newbie
Joined: 21 Aug 2007 Posts: 6
|
Posted: Wed Aug 22, 2007 2:57 am |
Aha! Thank you very much, yes that does work! Now, is there a way to have that be loaded by default so that I don't have to enter the bit of code every time I start up cMUD? This does work well enough and I'll buy the program if I can make that happen! It would also be nice to have the program warn while I'm typing and before I even hit enter, but I'm guessing that this isn't possible without modifying cMUD itself?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Aug 22, 2007 3:01 am |
Yep - it's already saving it without you having to do a thing.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Aug 22, 2007 3:38 am |
Since you liked that I thought we could do a little better. I am sure after a little bit of playing you will figure out how to adjust the level of reporting in this. Also one of the variables make use of what is called a default value, so it will automatically reset on each load. This script includes an alias ResetLimit that lets you clear the counter variable easily. This gives you a total byte counter, and a line limit. Anything over the line limit will be shuffled back into the command line with word breaks respected. As with the previous script just copy and paste this into the command line.
Code: |
#DELCLASS Limit
#CLASS Limit
#ALIAS ResetLimit {ByteCounter=0}
#VAR BytesLimit 7000
#VAR LineLimit 75
#VAR ByteCounter 0 0
#ONINPUT {(*)} {
#IF (%len(%1)>@LineLimit) {
#NOINPUT
#LOCAL LineData
#CALL %regex(%copy(%1,1,@LineLimit),"(.*) .*?",$LineData)
$LineData=%trim($LineData)
#ADD ByteCounter (%len($LineData)+2)
#SEND {$LineData}
#SHOWP "Line adjusted shorter, "
#INPUT {%trim(%remove($LineData,%1))}
} {
#ADD ByteCounter (%len(%1)+2)
}
#SHOW {@ByteCounter bytes sent, max @BytesLimit}
#IF (@ByteCounter>@BytesLimit) {
#SHOW {%ansi(high,red)BYTE LIMIT EXECEEDED! BYTE LIMIT EXECEEDED!}
}
} "" {notrig}
#CLASS 0 |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
tekphnx Newbie
Joined: 21 Aug 2007 Posts: 6
|
Posted: Fri Aug 24, 2007 12:48 am |
Thank you everyone for all your help! I got this working much to my liking now, and I think I'll be sticking with CMUD.
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun Aug 26, 2007 7:33 pm |
Consequently, what's the syntax for using this in zMUD since it doesn't have #NOINPUT?
Charneus |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Aug 26, 2007 7:38 pm |
In zMUD, #gag will stop the command being sent. In CMUD, it just stops it being displayed.
|
|
|
|
|
|