[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Simple script to split long commands

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Simple script to split long commands
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,800 posts)  [Biography] bio   Forum Administrator
Date Sun 20 Mar 2011 06:37 AM (UTC)  quote  ]
Message
That's easy enough ...

Template:saveplugin=Show_Command_Buffer_Size To save and install the Show_Command_Buffer_Size plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Show_Command_Buffer_Size.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Show_Command_Buffer_Size.xml (which you just saved in step 3) as a plugin
  7. 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
[Go to top] top

Posted by Teasty   (2 posts)  [Biography] bio
Date Sun 20 Mar 2011 02:50 AM (UTC)  quote  ]
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?
[Go to top] top

Posted by Nick Gammon   Australia  (18,800 posts)  [Biography] bio   Forum Administrator
Date Sun 20 Mar 2011 01:52 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Teasty   (2 posts)  [Biography] bio
Date Sat 19 Mar 2011 07:18 AM (UTC)  quote  ]
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?
[Go to top] 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.


1,087 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]