mIRC Homepage
Posted By: uri on user command - 01/05/08 06:43 PM
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
Posted By: 5618 Re: on user command - 01/05/08 07:11 PM
You could simply use something like:
Code:
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.
Posted By: RusselB Re: on user command - 01/05/08 11:08 PM
Indeed there are shorter ways of doing that code, here's one.
Code:
on @*:text:!voice*:#: mode $chan +v $iif($$2 ison $chan,$v1,$nick)
Posted By: Riamus2 Re: on user command - 02/05/08 01:46 AM
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.
Posted By: uri Re: on user command - 02/05/08 02:31 AM
half way complete!!!.from ur side i got onli !voice nick!!! abt hw !voice urself!! n !devoice nick n !devoice urself!!!!
Posted By: uri Re: on user command - 04/05/08 04:30 AM
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!!!
Posted By: RusselB Re: on user command - 04/05/08 09:40 AM
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
Code:
#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
Posted By: Riamus2 Re: on user command - 04/05/08 12:15 PM
RussellB, you're still using that $iif that is flawed. smile
Posted By: hixxy Re: on user command - 04/05/08 12:23 PM
Code:
#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 end


RusselB: 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.
Posted By: uri Re: on user command - 04/05/08 01:55 PM
<5+Dmoe> !devoice
*** 01You: No such nick/channel
*** 01You: No such nick/channel


am getting error from above scripts@@@@@@@@@@@@@2
Posted By: hixxy Re: on user command - 04/05/08 07:19 PM
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?
Posted By: RoCk Re: on user command - 04/05/08 07:24 PM

.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
Posted By: qwerty Re: on user command - 04/05/08 07:31 PM
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.
Posted By: qwerty Re: on user command - 04/05/08 07:33 PM
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.
Posted By: RoCk Re: on user command - 04/05/08 07:36 PM

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.
crazy
Posted By: hixxy Re: on user command - 04/05/08 10:30 PM
$ifmatch/$ifmatch2 still work.
© mIRC Discussion Forums