Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Few Mirc Snippets I Have Scripted
imacul8
post Jul 12 2006, 09:09 AM
Post #1


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 21-May 06
From: Adelaide, Australia
Member No.: 24,017



Just a few things that may come in handy smile.gif

Backwards text snippet : will revers the text u input

CODE
bck {
  var %x = 1,%bck
  while (%x <= $len($1-)) { %bck = $mid($1-,%x,1) $+ %bck | inc %x }
  return %bck
}


Usage: $bck(text) ie. //echo -a $bck(hello everyone)
Returns: enoyreve olleh

Random letter/number generator : creates a random letter/number combo for the length specified.

CODE
rx {
  if ($1 == $null) { echo -a ERROR: You must specify a value for N | halt }
  if ($1 !isnum) { echo -a ERROR: The value of N can only be numbers | halt }
  if ($1 != $null) {
    var %i = $1
    while (%i > 0) {
      dec %i
      if ($r(1,3) == 3) { var %r = %r $+ $r(1,9) }
      elseif ($r(1,3) == 2) { var %r = %r $+ $r(A,Z) }
      else { var %r = %r $+ $r(a,z) }
    }
    return %r
  }
}


Usage: $rx(N) ie. //echo -a $rx(5)
Returns: w34ci, 7kag1, cxhqx, 15i62

RGB to Hex converter: converts rgb color values into hex color values

CODE
toHex {
  var %hexChars = 0123456789ABCDEF
  var %r.i = $dremain($1,16)
  var %g.i = $dremain($2,16)
  var %b.i = $dremain($3,16)
  var %r.j = $calc((($1 - %r.i) / 16) + 2)
  var %g.j = $calc((($2 - %g.i) / 16) + 2)
  var %b.j = $calc((($3 - %b.i) / 16) + 2)
  return $chr(35) $+ $chrat(%hexchars,%r.j) $+ $chrat(%hexchars,%r.i) $+ $chrat(%hexchars,%g.j) $+ $chrat(%hexchars,%g.i) $+ $chrat(%hexchars,%b.j) $+ $chrat(%hexchars,%b.i)
}
chrat {
  return $mid($1,$2,1)
}


Usage $tohex(red,green,blue) ie. //echo -a $tohex(255,255,255)
Returns: #FFFFFF

And thats all from me at the moment, hope these come in handy to somebody smile.gif

Notice from mayank:
Dont forget to add the code in code tags.
Go to the top of the page
 
+Quote Post
rldowling03
post Jul 13 2006, 02:07 AM
Post #2


Super Member
*********

Group: Members
Posts: 260
Joined: 17-April 06
From: Adelaide, Australia
Member No.: 21,994



Hey i like the backwards text one, But how do u get it to work so that u do it in a chat window and everyone can see u said that like when u normally talk?
Go to the top of the page
 
+Quote Post
imacul8
post Aug 7 2006, 09:48 AM
Post #3


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 21-May 06
From: Adelaide, Australia
Member No.: 24,017



you can just do //say $bck(hello everyone)

or add a on input event to your remotes section. and add a popup to enable,disable it from activating.

CODE
#bck on
ON *:INPUT:#: {
if ($left($1,1) != /) {
msg $active $bck($1-)
halt
  }
}
#bck end

menu channel {
  &Backwards Text On:.enable bck
  &Backwards Text Off:.disable bck
}


This should do the job nicely!! smile.gif

This post has been edited by imacul8: Aug 7 2006, 09:50 AM
Go to the top of the page
 
+Quote Post
tractor
post Oct 5 2006, 05:02 AM
Post #4


Premium Member
********

Group: Members
Posts: 197
Joined: 28-September 06
Member No.: 30,705



QUOTE(imacul8 @ Aug 7 2006, 02:48 AM) *

you can just do //say $bck(hello everyone)

or add a on input event to your remotes section. and add a popup to enable,disable it from activating.

CODE
#bck on
ON *:INPUT:#: {
if ($left($1,1) != /) {
msg $active $bck($1-)
halt
  }
}
#bck end

menu channel {
  &Backwards Text On:.enable bck
  &Backwards Text Off:.disable bck
}


This should do the job nicely!! smile.gif


Really huh
QUOTE
* /msg: insufficient parameters (line 4, script13.ini)
I think you need to learn a little more and yet //say $bck(TEXT) dosn't work * /say: insufficient parameters
Go to the top of the page
 
+Quote Post
Urza
post Oct 5 2006, 05:03 AM
Post #5


Newbie [Level 1]
*

Group: Members
Posts: 13
Joined: 5-October 06
Member No.: 31,096



you could also do something like
CODE

bck {
  var %x = 1,%bck
  while (%x <= $len($1-)) { %bck = $mid($1-,%x,1) $+ %bck | inc %x }
  if ($isid) return %bck
  else msg $active %bck
}


also you havent added the $dremain alias anywhere.


Edit
Tractor - the only reason what he posted wouldnt work is if you deleted, or incorectly added the bck alias. If it doesn't work it is through no fault of his.

This post has been edited by Urza: Oct 5 2006, 05:05 AM
Go to the top of the page
 
+Quote Post
tractor
post Oct 5 2006, 05:07 AM
Post #6


Premium Member
********

Group: Members
Posts: 197
Joined: 28-September 06
Member No.: 30,705



I hope you know im Agent|Austin..... And hmm ill talk to you.
Go to the top of the page
 
+Quote Post
Urza
post Oct 5 2006, 05:12 AM
Post #7


Newbie [Level 1]
*

Group: Members
Posts: 13
Joined: 5-October 06
Member No.: 31,096



i do now, but that in no way changes the fact of what i said lol.

sooooo i really don't see how its relative tongue.gif
Go to the top of the page
 
+Quote Post
tractor
post Oct 5 2006, 05:30 AM
Post #8


Premium Member
********

Group: Members
Posts: 197
Joined: 28-September 06
Member No.: 30,705



Well ok. -.- Just thought your script didn't work xD It also might not work because i have another on INPUT scrip
Go to the top of the page
 
+Quote Post
AlternativeNick
post Oct 5 2006, 05:48 AM
Post #9


Super Member
*********

Group: Members
Posts: 210
Joined: 7-June 06
Member No.: 24,817



good stuff imacul8, thanks for posting

if you dont mind my contribution, i have a useful snippet to post as well, this will kick/ban a user in all channels you have access in.

CODE
alias gban {
  var %i = 0
  while (%i < $chan(0)) {
    inc %i
    ban $iif($1 ison $chan(%i),-k) $chan(%i) $1 2 $2-
  }
}


Usage- /gb <nick> [Reason]

also, just for fun-
CODE

alias maybe { return $($+($,$r(1,$0)),2) }


Usage- $maybe(yes,no,maybe)
will return either yes, no, or maybe