Custom Prefix Script

By Alpha Atom on Jan 27, 2011

This is a custom prefix script, it replaces, when people message the channel, or you do, the ~&@%+ with Owner: or Admin: or Op: or HalfOp: or Voice: complete with colours.

Examples:

<18:00:30> Test <18:00:53> Test <18:01:03> Test <18:01:27> Test <18:02:00> Test <18:01:13> Test I plan to add more, such as custom kicks, bans, joins, parts and quits. Also, I understand the code could probably be a lot cleaner and tidier, but here's the share anyway :) Also with the million $+'s I've used, I know it could be easier with $+() but it works fine so I'm not bothered. ```mirc on ^*:TEXT:*:#:{ if ($chr(126) isin $nick($chan,$nick).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Owner: $+ $+(,6,$nick,) $+ $chr(62) $1- haltdef halt } if ($chr(38) isin $nick($chan,$nick).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Admin: $+ $+(,10,$nick,) $+ $chr(62) $1- haltdef halt } if ($nick isop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Op: $+ $+(,2,$nick,) $+ $chr(62) $1- haltdef halt } if ($nick ishop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14HalfOp: $+ $+(,7,$nick,) $+ $chr(62) $1- haltdef halt } if ($nick isvoice $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Voice: $+ $+(,5,$nick,) $+ $chr(62) $1- haltdef halt } echo -l $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14User: $+ $+(,4,$nick,) $+ $chr(62) $1- haltdef } on ^*:ACTION:*:#:{ if ($chr(126) isin $nick($chan,$nick).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Owner: $+ $+(,6,$nick,) $+(,6,$1-,) haltdef halt } if ($chr(38) isin $nick($chan,$nick).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Admin: $+ $+(,10,$nick,) $+(,6,$1-,) haltdef halt } if ($nick isop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Op: $+ $+(,2,$nick,) $+(,6,$1-,) haltdef halt } if ($nick ishop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6HalfOp: $+ $+(,7,$nick,) $+(,6,$1-,) haltdef halt } if ($nick isvoice $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Voice: $+ $+(,5,$nick,) $+(,6,$1-,) haltdef halt } echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* $+(,4,$nick,) $+(,6,$1-,) haltdef } on *:INPUT:#:{ if ($1 == /me) { if ($chr(126) isin $nick($chan,$me).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Owner: $+ $+(,6,$me,) $+(,6,$2-,) haltdef .describe # $2- halt } if ($chr(38) isin $nick($chan,$me).pnick) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Admin: $+ $+(,10,$me,) $+(,6,$2-,) haltdef .describe # $2- halt } if ($me isop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Op: $+ $+(,2,$me,) $+(,6,$2-,) haltdef .describe # $2- halt } if ($me ishop $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6HalfOp: $+ $+(,7,$me,) $+(,6,$2-,) haltdef .describe # $2- halt } if ($me isvoice $chan) { echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* 6Voice: $+ $+(,5,$me,) $+(,6,$2-,) haltdef .describe # $2- halt } echo -l $chan $chr(60) $+ $time $+ $chr(62) 6* $+(,4,$me,) $+(,6,$2-,) haltdef .describe # $2- } if ($left($1-,1) != /) { if ($chr(126) isin $nick($chan,$me).pnick) { echo $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Owner: $+ $+(,6,$me,) $+ $chr(62) $1- haltdef .msg # $1- halt } if ($chr(38) isin $nick($chan,$me).pnick) { echo $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Admin: $+ $+(,10,$me,) $+ $chr(62) $1- haltdef .msg # $1- halt } if ($me isop $chan) { echo $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Op: $+ $+(,2,$me,) $+ $chr(62) $1- haltdef .msg # $1- halt } if ($me ishop $chan) { echo $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14HalfOp: $+ $+(,7,$me,) $+ $chr(62) $1- haltdef .msg # $1- halt } if ($me isvoice $chan) { echo $chan $chr(60) $+ $time $+ $chr(62) $chr(60) $+ 14Voice: $+ $+(,5,$me,) $+ $chr(62) $1- haltdef .msg # $1- halt } echo $chan $+($chr(60),$time,$chr(62)) $chr(60) $+ 14User: $+ $+(,4,$me,) $+ $chr(62) $1- haltdef .msg # $1- } } ```

Comments

Sign in to comment.
Jethro   -  Jan 27, 2011

Ok, but sometimes an example may not properly register in someone's mind unless we can be as descriptive as possible when it comes to offering an input? :P

 Respond  
napa182   -  Jan 27, 2011

Jethro_ Wrote:

napa, you forgot to negate:
as I said...
napa182 Wrote:
just as an example to give you an idea:

 Respond  
Jethro   -  Jan 27, 2011

napa, you forgot to negate:

on *:input:*:{
  if ($readini(mirc.ini,text,commandchar) != $left($1,1)) && (!$ctrlenter) && (!$inpaste) {
 Respond  
napa182   -  Jan 27, 2011

redundancy in a code is never a good idea...

can be shorter as Jethro said
just as an example to give you an idea:

on *:input:*:{
  haltdef
  tokenize 32 $left($nick(#,$me).pnick,1) $1-
  echo -t # $+(<,$iif($istok(~.&.@.%.+,$1,46),$&
    $replace($1,~,Owner,&,Admin,@,Op,%,Halfop,+,Voice),User),:,$me,>) $2-
  .msg # $2-
}

or use an alias to do it for the events...

 Respond  
Alpha Atom   -  Jan 27, 2011

I was going to make an alias, but I hadn't realised I'd need so many if statements all the time. Ah well, it's done now :P

 Respond  
Jethro   -  Jan 27, 2011

You're going the long way to check for user mode prefixes. You can just use:

if ($nick($chan,$nick,~)) {

to check for owners.

if ($nick($chan,$nick,&))) {

to check for admins. Same thing for the input event:

if ($nick($chan,$me,~)) {
if ($nick($chan,$me,&)) {

You can combine these events by calling an alias so you don't repeat the same routine.

 Respond  
KilllerX   -  Jan 27, 2011

NEAT-o!!!! this is awesome.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.