Mimic

By Tuten on Dec 19, 2010

Screenshots

A mimic script that will both mimic and reverse mimic any nickname on any designated channel. just copy the code and paste it in the remotes.

How it works:
Select the nickname and click apply.
Select the channel and click apply.
If u want to mimic switch from off to on position in the mimic box.
If u want to reverse mimic switch from off to on position in the reverse mimic box.
and thats about it.. enjoy.. ;)

(initial credits to FRISH and also a thank you to Jethro_)

menu Channel {
  Mimic:{
    dialog -am mimicerd mimicerd
  }
}
dialog mimicerd {
  title "Mimic"
  size -1 -1 166 54
  option dbu
  combo 2, 5 36 75 10, sort edit vsbar drop
  button "Apply", 3, 84 35 22 10
  button "Apply", 8, 84 11 22 10
  combo 10, 5 12 75 10, sort edit vsbar drop
  box "Nickname", 11, 2 1 108 51
  box "Channel", 12, 2 26 108 26
  box "Mimic", 1, 113 1 51 25
  box "Reverse Mimic", 9, 113 27 51 25
  radio "Start", 4, 115 10 22 10, group
  radio "Stop", 6, 139 10 22 10
  radio "Start", 5, 115 36 22 10, group
  radio "Stop", 7, 139 36 22 10
}

on *:dialog:mimicerd:init:*: {
  did -c mimicerd 6
  did -c mimicerd 7
  did -a $dname 2,10
  var %Allnicks $nick($active,0)
  while (%Allnicks > 0) {
    did -a $dname 10 $nick($active,%Allnicks)
    dec %Allnicks
  }
  var %Allchans $chan(0)
  while (%Allchans > 0) {
    did -a $dname 2 $chan(%Allchans)
    dec %Allchans
  }
}
on *:dialog:mimicerd:sclick:*: {
  if ($did == 3) { 
    if (!$did(2)) { unset %chnl }
    else {
      set %chnl $did(2)
    }
  }
  if ($did == 4) { set %mimic 1 }
  if ($did == 5) { set %rmimic 1 }
  if ($did == 6) { unset %mimic }
  if ($did == 7) { unset %rmimic }
  if ($did == 8) { 
    if (!$did(10)) { unset %mnick }
    else {
      set %mnick $did(10)
    }
  }
}

on *:text:*:#:mimic $1- 
on *:action:*:#:mimic $1- 
on *:notice:*:#:mimic $1- 
alias -l mimic { 
  if ($left($1,1) == !) { halt } 
  if (%mimic == 1) && ($nick == %mnick) && (# == %chnl) { 
    $iif($event = text,msg,$iif($event = notice,notice,$iif($event = action,describe))) # $1- 
  } 
  if (%rmimic == 1) && ($nick == %mnick) && (# == %chnl) { 
    var %nintext $len($1-) + 1 
    while (0 < %nintext) { 
      var %msgreverse %msgreverse $+ $mid($1-, $+ %nintext $+ ,1) 
      if ($mid($1-, $+ %nintext $+ ,1) == $chr(32)) { var %msgreverse %msgreverse $chr(32) } 
      %nintext = %nintext - 1 
    } 
    $iif($event = text,msg,$iif($event = notice,notice,$iif($event = action,describe))) # %msgreverse 
  } 
}

Comments

Sign in to comment.
Jethro   -  Dec 19, 2010

You can even shrink the alias more by using regsubex for the reverse part of the code:

alias -l mimic {
  if ($left($1,1) == !) { halt }
  if ($nick == %mnick) && (# == %chnl) {
    if (%mimic) {
      $iif($event = text,msg,$iif($event = notice,notice,$iif($event = action,describe))) # $1-
    }
    elseif (%rmimic) {
      $iif($event = text,msg,$iif($event = notice,notice,$iif($event = action,describe))) # $regsubex($1-,/(.)/g,$mid(\A,-\n,1)))
    }
  }
}

You don't have to repeate the %mnick and %chnl variables. Just make an if condition will get both routines covered.

 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.