Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Plugins
➜ Simple script to split long commands
Simple script to split long commands
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Teasty
(2 posts) Bio
|
Date
| Sat 19 Mar 2011 07:18 AM (UTC) |
Message
| I wanted to see if any one could help me out, I've been searching and searching and haven't come up with anything that can help me.
Basically what I need is a script that counts the characters in the command window, if it's above a certain amount it would spit it and prepend the next command with a command of my choosing.
IE a post is 15000 long, after every 500 characters it would cut it off at the end of the next word and command split then prepend the next line with 'say' or another command (rest of text) and the same after the next 500 characters and so on.
In effect it would be something like this.
Input
Say (1500 characters)
Output
Say (500 Characters + last word);
Say (next 500 characters + last word);
Say (last 500 Characters)
This would allow me to make really long speeches or poses safely without running into much/mud/mush buffer limits and having to tediously go to the previous command history and reenter the portion of my text it cut out.
Can any one help?
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 20 Mar 2011 01:52 AM (UTC) |
Message
| Well, it could be done. You would need to make a plugin. Inside that plugin have a OnPluginCommandChanged function which detects when something has changed in the command window. So what you probably want is this ...
First get the command window contents (GetCommand). Then check:
- Command longer than 500 characters.
- Last thing there is a space character (so you don't split words) or possible period/space.
Then you could do PushCommand to push it into the command history, and clear the command window, and then use Send to send it to the MUD. Then perhaps put "say " back into the command window.
I don't see how you can leave the command there though - how would it know where to split it the second time? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Teasty
(2 posts) Bio
|
Date
| Reply #2 on Sun 20 Mar 2011 02:50 AM (UTC) |
Message
| So your saying it can be done, but not as easily as I'd hoped?
What about this then, can we count the characters and display the count someplace so that I know when to split the command? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 20 Mar 2011 06:37 AM (UTC) |
Message
| That's easy enough ...
|
To save and install the Show_Command_Buffer_Size plugin do this:
- Copy between the lines below (to the Clipboard)
- Open a text editor (such as Notepad) and paste the plugin into it
- Save to disk on your PC, preferably in your plugins directory, as Show_Command_Buffer_Size.xml
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file Show_Command_Buffer_Size.xml (which you just saved in step 3) as a plugin
- Click "Close"
|
That will show in the status line (right at the bottom) how much is in your command window.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Show_Command_Buffer_Size"
author="Nick Gammon"
id="14934dc8f688f0cd6a14aa2e"
language="Lua"
purpose="Shows how many characters are in the command window"
date_written="2011-03-20"
requires="4.38"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
function OnPluginCommandChanged ()
local command = GetCommand ()
SetStatus ("Command length = " .. #command)
end -- function
]]>
</script>
</muclient>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
11,579 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top