| 
 | 
 
| 
 
uri
 
 | 
 
| 
 uri 
 | 
when user does !voice i wil set them voice...so basically i like to add up!! when user does !voice nick i wil set the voice to the user requested nick... !voice nick not the person who did !voice nick.... below is code is for !voice.. can u help me add up for !voice nick
 
  #Auto On on *:TEXT:*!voice*:*:mode # +v $nick | on *:TEXT:*!devoice*:*:mode # -v $nick |  #Auto End
  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
5618
 
 | 
 
| 
 5618 
 | 
You could simply use something like: on *:TEXT:!voice*:#:{
  if ($2) && ($2 ison $chan) { mode $chan +v $2 }
  else { mode $chan +v $nick }
}Though there are several (shorter) ways to achieve the same. Note that ANYONE can use this trigger to voice themselves or others.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2004 
Posts: 7,168  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2004 
Posts: 7,168  | 
Indeed there are shorter ways of doing that code, here's one. on @*:text:!voice*:#: mode $chan +v $iif($$2 ison $chan,$v1,$nick)  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Oct 2004 
Posts: 8,061  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Oct 2004 
Posts: 8,061  | 
I don't know that that would be the best solution.  If you specify a nick and the nick isn't in the channel, you'll be voiced.  It shouldn't do anything, imo, if a nick was specified but was not in the channel. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
uri
 
 | 
 
| 
 uri 
 | 
half way complete!!!.from ur side i got onli !voice nick!!!  abt hw !voice urself!! n !devoice nick n !devoice urself!!!! 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
uri
 
 | 
 
| 
 uri 
 | 
on @*:text:!voice*:#: mode $chan +v $iif($$2 ison $chan,$v1,$nick) #Auto On on *:TEXT:*!voice*:*:mode # +v $nick | .notice $nick You Have Been Given Voice In #  on *:TEXT:*!devoice*:*:mode # -v $nick | .notice $nick You Have Been Given Devoice In #  on @*:text:!voice*:#: mode $chan +v $iif($$2 ison $chan,$v1,$nick) #Auto End
 
 
  how do i make this scripts works 2gther!!!when i paste it 2gther one of them didnt work!!! 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Aug 2004 
Posts: 7,168  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Aug 2004 
Posts: 7,168  | 
It's not working because you can't have identical events in your code more than once. I see that you have introduced a group into your code.  How is this group controlled? I may have a better suggestion once you answer that question, but for now  #Auto on
on @*:text:!voice*:#:{
  mode $chan +v $iif($$2 ison $chan,$v1,$nick)
  .notice $vnick You Have Been Given Voice in #
}
on @*:text:!devoice*:#:{
  mode $chan -v $iif($$2 ison $chan,$v1,$nick)
  .notice $vnick You Have Been Given Devoice in #
}
#Auto end
on @*:text:!voice*:#:{
  mode $chan +v $iif($$2 ison $chan,$v1,$nick)
  .notice $vnick You Have Been Given Voice in #
}
Personally, I'd just go with the first two events that I posted here, and remove the group setting  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Oct 2004 
Posts: 8,061  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Oct 2004 
Posts: 8,061  | 
RussellB, you're still using that $iif that is flawed.     
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
#Auto on
on @*:text:!voice*:#:{
  if ($iif($2,$2,$nick) ison #) {
    mode # +v $v1
    .notice $v1 You have been given voice on #
  }
}
on @*:text:!devoice*:#:{
  if ($iif($2,$2,$nick) ison #) {
    mode # +v $v1
    .notice $v1 You have been stripped of voice on #
  }
}
#Auto endRusselB: your method will not work with just !voice or !devoice as $$2 would make the script halt if $2 does not exist as a parameter. That is the nature of using $$. For yours to work as the OP wants it you would have to type !voice non-existent-nick to voice yourself.  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
| 
 
uri
 
 | 
 
| 
 uri 
 | 
<5+Dmoe> !devoice *** 01You: No such nick/channel *** 01You: No such nick/channel
 
  am getting error from above scripts@@@@@@@@@@@@@2 
Last edited by uri; 04/05/08 03:40 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
I don't know where that "You" is coming from, because there's no "You" anywhere in the script.
  Have you got any other scripts loaded? 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 2,002  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 2,002  | 
 .notice $v1 You have been stripped of voice on #
  There is no $2 if someone just types !devoice so $v1 will be $null making the word You the target.
  Try using $ifmatch instead of $v1
  
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jan 2003 
Posts: 2,125  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jan 2003 
Posts: 2,125  | 
This indicates $v1 is empty at the time /notice is called, which might happen if you have a /mode alias (that uses if statements). To check that, type  //echo -a > $isalias(mode).fname If that outputs a filename, it means you have a /mode alias there. To bypass that alias, you can use !mode instead of plain mode.
  Once more, /echo is your friend. You can use "/echo -a > $v1" in various places in your script to check if $v1 has the correct value. 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Jan 2003 
Posts: 2,125  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Jan 2003 
Posts: 2,125  | 
If there's no $2, $nick is used, so $v1 should never be $null, unless external factors interfere (like a /mode alias), due to $v1 being "global". Besides, /notice is called only if mirc passes the ison check, which means that $v1 is definitely a valid value initially.
  Your $ifmatch suggestion is still valid though, in case the OP uses an old version of mirc. 
Last edited by qwerty; 04/05/08 07:37 PM.
 
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Dec 2002 
Posts: 2,002  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Dec 2002 
Posts: 2,002  | 
Yeah I just realized that I didn't take into account the $iif actually being inside an if statement so that whatever $iif returns, it will always be $v1. Thanks for pointing it out. Either way, it still made the word You the target because $v1 is empty for whatever reason as you said. ~ Edit ~ $ifmatch is still valid in new versions isn't it? It's still in the help file anyway and still works as it always has. I suggested it before realizing my mistake thinking it would return the correct match from $iif whichever it was. In this case though I guess $ifmatch would return $true from the if statement rather than returning a nick.   
 
 |  
 
 | 
 
 
 |  
 
| 
 | 
 
Joined:  Sep 2005 
Posts: 2,630  
Hoopy frood 
 | 
 
 
Hoopy frood 
Joined:  Sep 2005 
Posts: 2,630  | 
$ifmatch/$ifmatch2 still work. 
 
 |  
 
 | 
 
 
 |  
 
   |  
 
 |