Legends of the Jedi Forums Newbie Watering Hole MUSHClient Script Request

Deprecated: Function bp_core_get_user_domain is deprecated since version 12.0.0! Use bp_members_get_user_url() instead. in /home/lotj/www/wordpress/wp-includes/functions.php on line 6170

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/lotj/www/wordpress/wp-includes/functions.php on line 6170

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/lotj/www/wordpress/wp-includes/functions.php on line 6170
This topic has 3 replies, 3 voices, and was last updated 14 years, 9 months ago by Zeromus.
Viewing 4 posts - 1 through 4 (of 4 total)
    • Inactive
      September 3, 2011 at 5:47 am #1753

      Would it be terribly difficult for someone to make a Mushclient script that, when you copied text from the MUD, added the &color tags to it? Sort of like the way mcl does copy-as-html with color.

    • Zeromus Participant
      September 3, 2011 at 6:14 am #17627

      Ctrl+D copy (like Ctrl+C but different)

      or: Ctrl + Left-click and select "Copy with Colour"

      [code:1k0v2tlv]<?xml version="1.0" encoding="iso-8859-1"?>
      <!DOCTYPE muclient>

      <!– MuClient version 4.14 –>

      <!– Plugin "CopyScript" generated by Plugin Wizard –>

      <muclient>
      <plugin
      name="CopyColourCodes"
      author="Nick Gammon"
      id="cd4d50f5ffa67481d49243e6"
      language="Lua"
      purpose="Copies output from the output window with colour codes embedded"
      save_state="n"
      date_written="2007-11-12 08:00:00"
      requires="4.00"
      version="1.0"
      >

      </plugin>

      <aliases>
      <alias
      match="^CopyColourCodes:Copy$"
      enabled="y"
      regexp="y"
      menu="y"
      name="Copy_Colour_Codes"
      omit_from_output="y"
      sequence="100"
      script="CopyScript"
      >
      </alias>
      </aliases>

      <!– Script –>

      <script>
      <![CDATA[

      Accelerator ("F8", "CopyColourCodes:Copy")

      forecolour_lookup = {}
      backcolour_lookup = {}

      — make table to convert RGB codes into ANSI codes
      for i = 1, 8 do
      forecolour_lookup [GetNormalColour (i)] = { code = ANSI (i + 29), bold = false }
      forecolour_lookup [GetBoldColour (i)] = { code = ANSI (i + 29), bold = true }
      backcolour_lookup [GetNormalColour (i)] = { code = ANSI (i + 39), bold = false }
      end — all 8 colours

      — output the ANSI code to set an option, if it is not already set
      — (or unset it, if it is not already unset)

      function DoExtra (is_set, was_set, on_code, off_code)

      if is_set and (not was_set) then
      return ANSI (on_code) — send setting code
      end — need to set

      if (not is_set) and was_set then
      return ANSI (off_code) — send resetting code
      end — need to un-set it

      return "" — no change needed
      end — DoExtra

      — process each line in the output window

      function ProcessEachLine (line)
      local bold = false

      for style = 1, GetLineInfo (line, 11) do

      — do text colour
      fore = forecolour_lookup [GetStyleInfo (line, style, 14)]

      if fore and fore.code ~= lastfore then
      copystring = copystring .. fore.code
      bold = fore.bold
      lastfore = fore.code
      end — foreground colour change

      — do background colour
      back = backcolour_lookup [GetStyleInfo (line, style, 15)]

      if back and back.code ~= lastback then
      copystring = copystring .. back.code
      lastback = back.code
      end — foreground colour change

      DoExtra (bold, lastbold, 1, 22)
      lastbold = bold

      — do other styles (underline, blink, inverse)

      bold = GetStyleInfo (line, style, 8) — bold flag
      copystring = copystring .. DoExtra (bold, lastbold, 1, 22)
      lastbold = bold

      ul = GetStyleInfo (line, style, 9) — underline flag
      copystring = copystring .. DoExtra (ul, lastul, 4, 24)
      lastul = ul

      blink = GetStyleInfo (line, style, 10) — blink flag
      copystring = copystring .. DoExtra (blink, lastblink, 3, 23)
      lastblink = blink

      inverse = GetStyleInfo (line, style, 11) — inverse flag
      copystring = copystring .. DoExtra (inverse, lastinverse, 7, 27)
      lastinverse = inverse

      — now the text itself
      copystring = copystring .. GetStyleInfo (line, style, 1)

      end — for each style

      — add line break
      if GetLineInfo (line, 3) then
      copystring = copystring .. "rn"
      end — if newline wanted

      end — ProcessEachLine

      — alias starts here

      function CopyScript(name, line, wildcs)
      local line1, line2 = GetSelectionStartLine(), GetSelectionEndLine()

      if line1 == 0 then
      utils.msgbox ("No text selected", "Cannot copy", "ok", "!")
      return
      end

      — start with ANSI reset
      copystring = ANSI (0)

      lastfore = forecolour_lookup [GetNormalColour (8)].code — reset is white
      lastback = backcolour_lookup [GetNormalColour (1)].code — on black
      lastbold = false
      lastul = false
      lastblink = false
      lastinverse = false

      for line = line1, line2 do
      ProcessEachLine (line)
      end

      SetClipboard (copystring)

      end — function CopyScript
      ]]>
      </script>

      </muclient>[/code:1k0v2tlv]

    • Troll Participant
      September 3, 2011 at 8:04 pm #17648

      I tried using this, and attempted to copy "Councilman Rakun" from the who-list with all its colour tags and this is what it gave me to paste:

      [0mC[30mouncilman[37m R[30makun [32m

      That’s kinda dumb! <!– s:( –><img src="{SMILIES_PATH}/icon_sad.gif" alt=":(" title="Sad" /><!– s:( –>

    • Zeromus Participant
      September 3, 2011 at 8:17 pm #17649

      weird i dont know what’s wrong with it

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.