Difference between revisions of "Cut Scripts"

From The Broken Dagger Wiki
Jump to: navigation, search
m
 
(4 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
We recommend the following simple script for your use:
 
We recommend the following simple script for your use:
 +
<pre>
 
  on 1:input:*: {
 
  on 1:input:*: {
 
  if ($len($1-) > 420) {
 
  if ($len($1-) > 420) {
 
  %cuttext = $remove($1-,$left($1-,420))
 
  %cuttext = $remove($1-,$left($1-,420))
  /timercut 1 1 /say %cuttext
+
  /timercut 1 1 /say �E�6 %cuttext
 
  }
 
  }
 
  }
 
  }
 +
</pre>
  
[[Category:Rules]]
+
----
[[Category:Channel Rules]]
+
Or this not so simple one.
[[Category:Glossary (OOC)]]
+
<pre>
 +
  on 1:input:*: {
 +
  if ($len($1-) > 420) {
 +
    { %pos = 420
 +
      :loop
 +
      if %pos < 390 goto end |
 +
      %chara = $mid($1-,%pos,1)
 +
      if $asc(%chara) == 32 goto end |
 +
      %pos = %pos - 1
 +
      goto loop
 +
      :end
 +
    }
 +
    %first = $left($1-,%pos - 1)  
 +
    %cuttext = $remove($1-,%first)
 +
    %prefix = $left(%first,4)
 +
    %mtch = { /me  }
 +
    if (%prefix == %mtch) { %metxt = $remove(%first,%mtch) | /me %metxt } | /else { /say �E�6 %first }
 +
    /say �E�6 %cuttext
 +
    /halt
 +
  }
 +
</pre>
 +
----
 +
This script will (possibly) only work in mIRC, and handles up to three posts worth of text.  Just put it into your Remote Scripts and load it.
 +
<pre>
 +
on *:input:*: {
 +
  if ( ( $left($1,1) != / ) || ( $1 == /me ) ) {
 +
    var %next = -
 +
    var %continue = -
 +
    var %done =  -|
 +
    var %more = -
 +
    var %textlen = $len($1-)
 +
    if (%textlen > 400) {
 +
      var %pos = 1
 +
      var %text = $mid($1-, %pos, 400)
 +
      var %firsttime = 1
 +
      while ( %text != $null ) {
 +
        if ( $len($deltok(%text, -1, 32)) < 370 ) {
 +
          %text = $left(%text, 370)
 +
          inc %pos 370
 +
        }
 +
        else {
 +
          %text = $deltok(%text,-1,32)
 +
          inc %pos $len(%text)
 +
          inc %pos
 +
        }
 +
        var %outtext = %text
 +
        %text = $mid($1-, %pos, 400)
 +
        if (%firsttime == 1) {
 +
          if ($gettok(%outtext, 1, 32) == /me) {
 +
            %outtext %next
 +
          }
 +
          else {
 +
            say %outtext %next
 +
          }
 +
          %firsttime = 0;
 +
        }
 +
        else {
 +
          if (%text != $null) {
 +
            say %continue %outtext %next
 +
          }
 +
          else {
 +
            if (%textlen <= 945) {
 +
              say %continue %outtext %done
 +
            }
 +
            else {
 +
              say %continue %outtext %more
 +
            }
 +
          }
 +
        }
 +
      }
 +
      halt
 +
    }
 +
  }
 +
}
 +
</pre>
 +
----
 +
This script will cut back to the word, keep your control codes, and will even let you use the MU* action command (the colon) in place of /me! It will color code your quoted text for you. No more need to color format between quotes manually. It will also auto format your text, and apply these features to your existing aliases... To some degree.
 +
 
 +
Text between quotes will be black. "Normal text"
 +
For a whisper (light grey) w"Text to be whispered"
 +
For a soft tone (Dark Grey) s"Text said softly"
 +
For shouted or loud text (Bold black) l"Shouted text"
 +
Anything beyond an endquote will be deformatted, and colored action purple. You may change these as you like.
 +
 
 +
This feature can be turned on by typing /aon or turned off by typing /aoff
 +
 
 +
Questions? Problems? Emails are welcome at dave@dreamscape.nu or auriela@dreamscape.nu!
 +
 
 +
<pre>
 +
on 1:input:*:{
 +
  ; Modify %CutStyle to your liking. (This starts off the cut text, at
 +
  ; the beginning of your next post.)
 +
  %CutStyle = �E�2 --
 +
 
 +
  ; Modify %CStrailer to your liking. (This is what shows up at the end
 +
  ; of your first paragraph.)
 +
  %CStrailer = �E�2 --
 +
 
 +
  ; To disable Quotation auto formatting, change %AutoFormatting to OFF
 +
  if ($mid(%AutoFormatting,1,1) != O) {
 +
    %AutoFormatting = ON
 +
  }
 +
  ; The following sets colors and formatting for quoted text.
 +
  set %whisperTone �E�15"
 +
  set %softTone �E�14"
 +
  set %normalTone �E�1"
 +
  set %loudTone �E��E�1"
 +
  set %endTone "�E��E�6
 +
 
 +
  ; The following sets the search codes for automatic text coloring.
 +
  set %whisperQuote w"
 +
  set %softQuote s"
 +
  set %normalQuote "
 +
  set %loudQuote l"
 +
  set %endquote "
 +
 
 +
  %n = 1
 +
  %act = 0
 +
  %cut = 0
 +
  %QEnc = 1
 +
  %codes = $chr(0)
 +
  %chr = $chr(0)
 +
 
 +
  if ($1 == /aoff) { %AutoFormatting = OFF | /echo $active �E�12�E�Auto Formatting OFF | /halt }
 +
  if ($1 == /aon) { %AutoFormatting = ON | /echo $active �E�12�E�Auto Formatting ON | /halt }
 +
 
 +
  if (($1 == /me) || ($1 == $chr(58))) {
 +
    %codes = $chr(3) $+ 6
 +
    %act = 1
 +
    %QEnc = 1
 +
    %len = 424 - $len($me)
 +
  }
 +
  else {
 +
    if (" !isin $mid($1,1,2)) {
 +
      if ($mid($1,1,2) != �E�6) { %endTone = "�E� }
 +
    }
 +
    %act = 0
 +
    %len = 430 - $len($me)
 +
  }
 +
  if ($len($1-) > %len) {
 +
    %cut = 1
 +
    while (%chr != $chr(32)) {
 +
      %len = %len - 1
 +
      %chr = $mid($1-,%len,1)
 +
    }
 +
    %scantext = $left($1-,%len)
 +
    %lefttext = %scantext
 +
    %cuttext = $right($1-,$mid($1-,%len,0))
 +
  }
 +
  else {
 +
    %lefttext = $1-
 +
  }
 +
 
 +
  if ((%AutoFormatting == ON) && (%QEnc == 1)) {
 +
    %scantext = $QuoteEncode(%scantext)
 +
    %lefttext = $QuoteEncode(%lefttext)
 +
    %cuttext = $QuoteEncode(%cuttext)
 +
  }
 +
 
 +
  while (%n != 0) {
 +
    %n = $regsub(scan,%scantext,/([�E��E��E��E�]|�E�\d{1 $+ $chr(44) $+ 2} $+ $chr(44) $+ ?\d?\d?)/,$chr(0),%scantext)
 +
    %codes = %codes $+ $regml(scan,1)
 +
  }
 +
  if (%cut == 1) {
 +
    /timerCutScript 1 1 /say %CutStyle $+ �E� $+ %codes %cuttext
 +
    %lefttext = %lefttext $+ %CSTrailer
 +
  }
 +
  if (%act == 1) {
 +
    /me $deltok(%lefttext,1,32)
 +
    /halt
 +
  }
 +
  else {
 +
    if ($mid(%lefttext,1,1) != /) {
 +
      /say %lefttext
 +
      /halt
 +
    }
 +
 
 +
  }
 +
}
 +
 
 +
alias QuoteEncode {
 +
  %CSQtext = $1-
 +
  %CSQtext = $replace(%CSQtext,%whisperQuote,%whisperTone)
 +
  %CSQtext = $replace(%CSQtext,%softQuote,%softTone)
 +
  %CSQtext = $replace(%CSQtext,$chr(32) $+ %normalQuote,$chr(32) $+ %normalTone)
 +
  %CSQtext = $replace(%CSQtext,%loudQuote,%loudTone)
 +
  %CSQtext = $replace(%CSQtext,%endQuote $+ $chr(32),%endTone $+ $chr(32))
 +
  /return %CSQtext
 +
}
 +
</pre>

Latest revision as of 16:46, 15 July 2014

Cut Scripts are a term used for a small bit of code that automatically parse text to post multiple paragraphs in an IRC channel, if the text is too long. This is done because IRC limits the amount of text which may be posted to a channel in any one paragraph. Some players choose to circumvent this limit by means of scripts designed to place excess text into a post of its own. The use of such scripts is permitted in #Broken_Dagger and its associated channels, so long as they don't contradict our OOC rules by adding inappropriate symbols or colour to that text.

We recommend the following simple script for your use:

 on 1:input:*: {
 if ($len($1-) > 420) {
 %cuttext = $remove($1-,$left($1-,420))
 /timercut 1 1 /say �E�6 %cuttext
 }
 }

Or this not so simple one.

  on 1:input:*: { 
  if ($len($1-) > 420) { 
    { %pos = 420 
      :loop 
      if %pos < 390 goto end | 
      %chara = $mid($1-,%pos,1) 
      if $asc(%chara) == 32 goto end | 
      %pos = %pos - 1 
      goto loop 
      :end 
    } 
    %first = $left($1-,%pos - 1) 
    %cuttext = $remove($1-,%first) 
    %prefix = $left(%first,4) 
    %mtch = { /me  } 
    if (%prefix == %mtch) { %metxt = $remove(%first,%mtch) | /me %metxt } | /else { /say �E�6 %first } 
    /say �E�6 %cuttext 
    /halt 
  } 

This script will (possibly) only work in mIRC, and handles up to three posts worth of text. Just put it into your Remote Scripts and load it.

on *:input:*: {
  if ( ( $left($1,1) != / ) || ( $1 == /me ) ) {
    var %next = -
    var %continue = -
    var %done =  -|
    var %more = -
    var %textlen = $len($1-)
    if (%textlen > 400) {
      var %pos = 1
      var %text = $mid($1-, %pos, 400)
      var %firsttime = 1
      while ( %text != $null ) {
        if ( $len($deltok(%text, -1, 32)) < 370 ) {
          %text = $left(%text, 370)
          inc %pos 370
        }
        else {
          %text = $deltok(%text,-1,32)
          inc %pos $len(%text)
          inc %pos
        }
        var %outtext = %text
        %text = $mid($1-, %pos, 400)
        if (%firsttime == 1) {
          if ($gettok(%outtext, 1, 32) == /me) {
            %outtext %next
          }
          else {
            say %outtext %next
          }
          %firsttime = 0;
        }
        else {
          if (%text != $null) {
            say %continue %outtext %next
          }
          else {
            if (%textlen <= 945) {
              say %continue %outtext %done
            }
            else {
              say %continue %outtext %more
            }
          }
        }
      }
      halt
    }
  }
}

This script will cut back to the word, keep your control codes, and will even let you use the MU* action command (the colon) in place of /me! It will color code your quoted text for you. No more need to color format between quotes manually. It will also auto format your text, and apply these features to your existing aliases... To some degree.

Text between quotes will be black. "Normal text" For a whisper (light grey) w"Text to be whispered" For a soft tone (Dark Grey) s"Text said softly" For shouted or loud text (Bold black) l"Shouted text" Anything beyond an endquote will be deformatted, and colored action purple. You may change these as you like.

This feature can be turned on by typing /aon or turned off by typing /aoff

Questions? Problems? Emails are welcome at dave@dreamscape.nu or auriela@dreamscape.nu!

on 1:input:*:{
  ; Modify %CutStyle to your liking. (This starts off the cut text, at
  ; the beginning of your next post.)
  %CutStyle = �E�2 --

  ; Modify %CStrailer to your liking. (This is what shows up at the end
  ; of your first paragraph.)
  %CStrailer = �E�2 --

  ; To disable Quotation auto formatting, change %AutoFormatting to OFF
  if ($mid(%AutoFormatting,1,1) != O) {
    %AutoFormatting = ON
  }
  ; The following sets colors and formatting for quoted text.
  set %whisperTone �E�15"
  set %softTone �E�14"
  set %normalTone �E�1"
  set %loudTone �E��E�1"
  set %endTone "�E��E�6

  ; The following sets the search codes for automatic text coloring.
  set %whisperQuote w"
  set %softQuote s"
  set %normalQuote "
  set %loudQuote l"
  set %endquote "

  %n = 1
  %act = 0
  %cut = 0
  %QEnc = 1
  %codes = $chr(0)
  %chr = $chr(0)

  if ($1 == /aoff) { %AutoFormatting = OFF | /echo $active �E�12�E�Auto Formatting OFF | /halt }
  if ($1 == /aon) { %AutoFormatting = ON | /echo $active �E�12�E�Auto Formatting ON | /halt }

  if (($1 == /me) || ($1 == $chr(58))) {
    %codes = $chr(3) $+ 6
    %act = 1
    %QEnc = 1
    %len = 424 - $len($me)
  }
  else {
    if (" !isin $mid($1,1,2)) {
      if ($mid($1,1,2) != �E�6) { %endTone = "�E� }
    }
    %act = 0
    %len = 430 - $len($me)
  }
  if ($len($1-) > %len) {
    %cut = 1
    while (%chr != $chr(32)) {
      %len = %len - 1
      %chr = $mid($1-,%len,1)
    }
    %scantext = $left($1-,%len)
    %lefttext = %scantext
    %cuttext = $right($1-,$mid($1-,%len,0))
  }
  else {
    %lefttext = $1-
  }

  if ((%AutoFormatting == ON) && (%QEnc == 1)) {
    %scantext = $QuoteEncode(%scantext)
    %lefttext = $QuoteEncode(%lefttext)
    %cuttext = $QuoteEncode(%cuttext)
  }

  while (%n != 0) {
    %n = $regsub(scan,%scantext,/([�E��E��E��E�]|�E�\d{1 $+ $chr(44) $+ 2} $+ $chr(44) $+ ?\d?\d?)/,$chr(0),%scantext)
    %codes = %codes $+ $regml(scan,1)
  }
  if (%cut == 1) {
    /timerCutScript 1 1 /say %CutStyle $+ �E� $+ %codes %cuttext
    %lefttext = %lefttext $+ %CSTrailer
  }
  if (%act == 1) {
    /me $deltok(%lefttext,1,32)
    /halt
  }
  else {
    if ($mid(%lefttext,1,1) != /) {
      /say %lefttext
      /halt
    }

  }
}

alias QuoteEncode {
  %CSQtext = $1-
  %CSQtext = $replace(%CSQtext,%whisperQuote,%whisperTone)
  %CSQtext = $replace(%CSQtext,%softQuote,%softTone)
  %CSQtext = $replace(%CSQtext,$chr(32) $+ %normalQuote,$chr(32) $+ %normalTone)
  %CSQtext = $replace(%CSQtext,%loudQuote,%loudTone)
  %CSQtext = $replace(%CSQtext,%endQuote $+ $chr(32),%endTone $+ $chr(32))
  /return %CSQtext
}