#Coding on IrCQNet

Please login or register.

Login with username, password and session length
Advanced search  

News:

The Gallery is back! Use the menu to navigate.

Pages: [1]   Go Down

Author Topic: [mIRC] Colour talker.  (Read 424 times)

0 Members and 1 Guest are viewing this topic.

forgotten

  • Administrator
  • Valued Contributor
  • *****
  • Karma: +6/-6
  • Offline Offline
  • Gender: Male
  • Posts: 276
    • View Profile
    • WWW
[mIRC] Colour talker.
« on: February 21, 2008, 08:02:00 pm »
Version 1.02 - Now detects if +c or +S is set on the channel, and will stop using colour if it is.

Copy the code below:

Code: [Select]
; Colour talker v1.02
;v1.00
;- first release
;v1.01
;- fixed a silly coding error -_-, my bad (numbers wouldn't show in colour talker)
;- added a bit more error checking, still not perfect, but I can't be arsed right now.
;v1.02
;- Detects channel mode +S or +c (strip colour codes, block colour codes) and will stop using colour in accordance
on *:LOAD:{
  echo -atc info * Info: Successfully loaded colour talker.
  echo -atc info * Info: For a quick guide on how to use this, type /ctalk help.
  echo -atc info * Info: Alternatively you may use the menu, Colour Talker, to set up this script, it only takes a few moments. Enjoy ;).
}
on *:UNLOAD:{
  echo -atc info * Info: Unloading all colour talker variables...
  .unset %ctalk.*
  echo -atc info * Successfully unloaded colour talker.
}

#Ctalker off
on *:INPUT:*: {
  if ($left($1,1) == $chr(47)) || (Status Window == $active) || (@* iswm $active) return
  if ((c isincs $chan($chan).mode) || (S isincs $chan($chan).mode)) return
  if ($ctalk == $false) {
    echo -atc info * Error: You have colour talker enabled but have not set up your colours, type $+($chr(2),/ctalk set,$chr(2)) to set it up.
  }
  else {
    ;set start marker
    var %x 1
    ;loop, while marker is less than total tokens
    while (%x <= $gettok($1-,0,32)) {
      ;get the first letter of current token
      var %first $mid($gettok($1-,[ %x ],32),1,1)
      ;get the rest of the word, set it to our text variable
      var %text %text $replace($mid($gettok($1-,[ %x ],32),1,1),[ %first ], $+($chr(3),[ %ctalk.c1 ],[ %first ],$chr(3),[ %ctalk.c2 ])) $+ $mid($gettok($1-,[ %x ],32),2,$calc($len($gettok($1-,[ %x ],32) - 1)))
      ;increase our marker, move on to next token     
      inc %x
    }
    msg $active %text
    halt
  }
}
#Ctalker END
alias ctalk {
  if $isid {
    if ($len(%ctalk.c1) == 1) || $len(%ctalk.c1) > 2) || (%ctalk.c1 > 15) || (%ctalk.c1 !isnum) return $false
    elseif ($len(%ctalk.c2) == 1) || $len(%ctalk.c2) > 2) || (%ctalk.c2 > 15) || (%ctalk.c2 !isnum) return $false
    else return $true
  }
  if ($ctalk == $false) echo -atc info * Error: Type $+($chr(2),/ctalk set,$chr(2)) to set up.
  if ($1) {
    if ($1 == on) {
      if ($group(#ctalker) == on) echo -atc info * Error: Colour talker is already enabled
      else {
        .enable #ctalker
        echo -atc info * Info: Colour talker is now $+($chr(2),enabled,$chr(2))
      }
    }
    if ($1 == off) {
      if ($group(#ctalker) == off) echo -atc info * Error: Colour talker is already disabled
      else {
        .disable #ctalker
        echo -atc info * Info: Colour talker is now $+($chr(2),disabled,$chr(2))
      }
    }
    if ($1 == set) {
      var %ctalk.confirm $$input(We are now going to set up the colour talker! $+ $crlf $+ $crlf $+ Press "Ctrl + K" for colour reference.,oi,Colour Talker)
      :colour1   
      set %ctalk.c1 $remove($$input(Choose a colour: e.g. 2,eo,Select Colour One,%ctalk.c1),$chr(3))
      if ($len(%ctalk.c1) > 2) || (%ctalk.c1 > 15) || (%ctalk.c1 !isnum) {
        echo -atc info * Error: Colour selected must be a numerical value between 0 and 15.
        goto colour1
      }
      if ($len(%ctalk.c1) == 1) set %ctalk.c1 $+(0,%ctalk.c1)
      :colour2
      set %ctalk.c2 $remove($$input(Choose a colour: Ex. 12,eo,Select Colour Two,%ctalk.c2),$chr(3))
      if ($len(%ctalk.c2) > 2) || (%ctalk.c2 > 15) || (%ctalk.c2 !isnum) {
        echo -atc info * Error: Colour selected must be a numerical value between 0 and 15.
        goto colour1
      }
      if ($len(%ctalk.c2) == 1) set %ctalk.c2 $+(0,%ctalk.c2)
    }
    if ($1 == help) || ($1 == info) {
      echo -atc info $str($chr(42),115)
      echo -atc info * The colour talker enables you type in colours that will brighten up your IRC chat a bit (or annoy other users!).
      echo -atc info * Please note this script took just a few minutes to conjure up. Any problems get in touch! forgotten, #mIRC, #Coding, 12www.binaryfront.com
      echo -atc info * Now the important stuff, how to use this thing:
      echo -atc info * To set the colour talker colours type: /ctalk on
      echo -atc info * To turn the colour talker on type: /ctalk on
      echo -atc info * To turn the colour talker off type: /ctalk on
      echo -atc info * For this guide again type: /ctalk help
      echo -atc info $str($chr(42),115)
    }
  }
  elseif ($1 == $null) echo -atc info * For help using the colour talker type: /ctalk help
}

menu channel,status {
  Colour Talker
  .Set Colours:ctalk set
  .Help/Info:ctalk help
  . -
  . $iif($group(#Ctalker) == on,$style(1) Enable,Enable):ctalk on
  . $iif($group(#Ctalker) == off,$style(1) Disable,Disable):ctalk off
}

Usage:
/ctalk help
    - Concise information on using this script

You can also use the popups.

I can't remember who requested this script, and I'm sure I passed it on via IRC anyway. But regardless :P here it is for everyone else to see. As always comments/criticism/advise welcomed.
Logged
http://www.netgeeks.org - Scripting/Coding/Programming Resource.
http://www.irchelp.co.uk - Help on and guides to IRC

Jamie

  • Codemonkey
  • Global Moderator
  • Valued Contributor
  • *****
  • Karma: +5/-1
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • View Profile
    • WWW
Re: [mIRC] Colour talker.
« Reply #1 on: February 21, 2008, 08:27:50 pm »
not bad, it's somewhat limited to UnrealIRCd (and - at a stretch - InspIRCd) networks only. I believe I've made mention of this in earlier threads/topics/posts either on this board or another, but use of $active within the parameters of this script's function is somewhat risky since said implementation can actually break a lot of mIRC's built in functionality - /editbox to name one
Logged

forgotten

  • Administrator
  • Valued Contributor
  • *****
  • Karma: +6/-6
  • Offline Offline
  • Gender: Male
  • Posts: 276
    • View Profile
    • WWW
Re: [mIRC] Colour talker.
« Reply #2 on: February 21, 2008, 08:54:22 pm »
Hmm you are right about $active actually, I could change it to "#,?" perhaps :O.


And yup ;| understandably is restricted to Unreal IRCd. Only way I can think of getting around the IRCd compatibility issues is to do a /raw version on connect/load, store a variable to see if the correct IRCd is being used.
Logged
http://www.netgeeks.org - Scripting/Coding/Programming Resource.
http://www.irchelp.co.uk - Help on and guides to IRC

Jamie

  • Codemonkey
  • Global Moderator
  • Valued Contributor
  • *****
  • Karma: +5/-1
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • View Profile
    • WWW
Re: [mIRC] Colour talker.
« Reply #3 on: February 21, 2008, 11:14:56 pm »
$target would be best for something like this.

As for doing a /raw version, it's moot given the IRCd tells you on connect anyway (I think it's raw 004 offhand, but I don't have any raw irc data handy to verify this)
Logged

forgotten

  • Administrator
  • Valued Contributor
  • *****
  • Karma: +6/-6
  • Offline Offline
  • Gender: Male
  • Posts: 276
    • View Profile
    • WWW
Re: [mIRC] Colour talker.
« Reply #4 on: February 22, 2008, 10:54:53 am »
Yep it is 004. That wont work when the script is loaded and one is connected already.

So think I'll use /raw version, and use a raw 351:*: event. Though later :P now it's time for lunch.
Logged
http://www.netgeeks.org - Scripting/Coding/Programming Resource.
http://www.irchelp.co.uk - Help on and guides to IRC

Jamie

  • Codemonkey
  • Global Moderator
  • Valued Contributor
  • *****
  • Karma: +5/-1
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • View Profile
    • WWW
Re: [mIRC] Colour talker.
« Reply #5 on: February 22, 2008, 04:25:50 pm »
true, but the beautiful thing about mIRC is that the scripts are loaded before attempting connections at startup. I don't know about how psyBNC handles reconnections tho (like if you connect via psyBNC, disconnect from the bouncer - but the bouncer maintains connection, and later reconnect)
Logged
Pages: [1]   Go Up
« previous next »
 

Page created in 0.248 seconds with 22 queries.