mIRC Home    About    Download    Register    News    Help

Print Thread
on user command #198582 01/05/08 06:43 PM
Joined: Jan 2005
Posts: 14
U
uri Offline OP
Pikka bird
OP Offline
Pikka bird
U
Joined: Jan 2005
Posts: 14
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

Re: on user command [Re: uri] #198584 01/05/08 07:11 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
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.

Re: on user command [Re: 5618] #198596 01/05/08 11:08 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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)

Re: on user command [Re: RusselB] #198608 02/05/08 01:46 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: on user command [Re: RusselB] #198614 02/05/08 02:31 AM
Joined: Jan 2005
Posts: 14
U
uri Offline OP
Pikka bird
OP Offline
Pikka bird
U
Joined: Jan 2005
Posts: 14
half way complete!!!.from ur side i got onli !voice nick!!! abt hw !voice urself!! n !devoice nick n !devoice urself!!!!

Re: on user command [Re: uri] #198752 04/05/08 04:30 AM
Joined: Jan 2005
Posts: 14
U
uri Offline OP
Pikka bird
OP Offline
Pikka bird
U
Joined: Jan 2005
Posts: 14
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!!!

Re: on user command [Re: uri] #198771 04/05/08 09:40 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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

Re: on user command [Re: RusselB] #198787 04/05/08 12:15 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
RussellB, you're still using that $iif that is flawed. smile


Invision Support
#Invision on irc.irchighway.net
Re: on user command [Re: uri] #198788 04/05/08 12:23 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

Re: on user command [Re: hixxy] #198794 04/05/08 01:55 PM
Joined: Jan 2005
Posts: 14
U
uri Offline OP
Pikka bird
OP Offline
Pikka bird
U
Joined: Jan 2005
Posts: 14
<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.
Re: on user command [Re: uri] #198804 04/05/08 07:19 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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?

Re: on user command [Re: uri] #198805 04/05/08 07:24 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

.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

Re: on user command [Re: uri] #198806 04/05/08 07:31 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: on user command [Re: RoCk] #198807 04/05/08 07:33 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: on user command [Re: qwerty] #198808 04/05/08 07:36 PM
Joined: Dec 2002
Posts: 2,021
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,021

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

Re: on user command [Re: RoCk] #198814 04/05/08 10:30 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
$ifmatch/$ifmatch2 still work.