mIRC Home    About    Download    Register    News    Help

Print Thread
voice #216301 07/11/09 08:48 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
Hi,...this is what I need and I have no clue how to do it. I want a script for a bot. When a chatter comes in and types !working in a pm to the bot, I want the bot to voice that chatter. I would also like this to be allowed only to certain chatters...perhaps from a predetermined list? But I have no idea how to create that list or where to put it in the bot. I am very, very new to all this so please be specific as to how to do it and where to put the various elements. Thanks in advance for any help.

Re: voice [Re: starr] #216303 07/11/09 11:52 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
The easiest way to go about this is using mirc's user list:
Code:
menu nicklist {
  Add $$1 to Voice:.auser -a voice $$1 | echo 2 # * Added $$1 to voice list.
  Remove $$1 from Voice:ruser voice $$1
}
on voice:TEXT:*:?: {
  if ($strip($1) == !working) && ($nick isin $ulist(*)) {
    pvoice 1 #YourChannel $nick
  }
}
Right click on your pop ups nick list to select people you want to add to your voice list, as well as the one you want to remove. Those added will be able to trigger the script upon !working. Those removed won't be able to anymore. Change #YourChannel to your actual channel name.

Re: voice [Re: starr] #216304 08/11/09 12:01 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on @10:text:!working:#: .mode $chan +v $nick
on *:text:!add*:*:  work add $nick $2-
on *:text:!rem*:*:  work rem $nick $2-
alias -l work {
  if $2 == starr {
    var %nicks = $replace($3-,$chr(44),$chr(32)), %a = 1, %b = $numtok(%nicks,32)
    while %a <= %b {
      $iif($1 == add,.auser -a,.ruser) 10 $gettok(%nicks,%a,32)
      inc %a
    }
  }
}

1) Replace starr in the above code with the nick you use on IRC.
2) To add one or more people to the list, use !add nick1 nick2 nick3 nick4,nick5,nick6...nickN
2a) Replace the nick representations above with the actual nicks.
2b) Nicks can be space or comma separated.
2c) This command can be sent from the channel or via pm.
3) Removing nicks is similar to adding them, but use !rem rather than !add

I hope this is clear enough. If not, please post back quoting the parts you don't understand and I will attempt to clarify.

Re: voice [Re: RusselB] #216306 08/11/09 02:03 AM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
This seems like the perfect solution, but I am unsure what you mean by replacing the nick representations with the actual nicks...is this what you mean?

var %nicks = $replace($3-,$susieq(44),$brainchild(32)), %a = 1, %b = $numtok(%nicks,32)

and thank you so much for your help

Re: voice [Re: starr] #216307 08/11/09 05:33 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
No.
In the actual code itself, only replace starr in the 5th line with the nick that you use. Aside from that, leave the actual code alone.

By
Quote:
Replace the nick representations above with the actual nicks.
I mean something like

!add John Henry Mark, Susan,Mary

Re: voice [Re: starr] #216311 08/11/09 08:54 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
Code:
on @voiced:text:!working:?:.mode # +v $nick
on *:text:*:#:if ($istok(!add.!rem,$strip($1),46)) xvoice $strip($1) $nick # $2-
alias -l xvoice {
  if $2 == starr {
    var %n $4-,%i 1
    while $gettok(%n,%i,32) {
      if ($v1 ison $3) $iif($1 == !add,.auser -a,.ruser) voiced $gettok(%n,%i,32)
      inc %i
    }
  }
}


!add/!rem nick1 nick2 nick3 nick4 (must be on chan)


WorldDMT
Re: voice [Re: starr] #216323 09/11/09 10:31 AM
Joined: Jul 2008
Posts: 236
S
s00p Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
I'd suggest learning, by yourself, by reading the mIRC help files. It probably wouldn't be a good idea to learn from the code pasted here as it appears some people haven't actually learnt a real programming language.

I don't mean to sound as though I'm having a go at them. Perhaps it would be a good idea for them to work out why their code looks like vomit, and attempt to correct that. After that point, they'd be at the stage where they can run various trials using $ticks to calculate the time it takes x repetitions of a certain task to complete. If all people would do this, most scripts would look and perform far better, as the code would be written in such a way that it was designed to be written.

Perhaps a better exercise would be to write an x86 assembly interpreter in mIRC, and slowly extend it to parse the mIRC scripting language. This isn't difficult, and is very enlightening. If you'd like documentation for the x86 assembly language, or any help, let me know. I'd be happy to help someone improve their coding style smile

Last edited by s00p; 09/11/09 10:33 AM.
Re: voice [Re: s00p] #216325 09/11/09 03:46 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
I am trying to learn from every source I can, and I appreciate any help I can get.
However, I don't believe saying someone's code looks like "vomit" is productive...in fact I find it rude.
As far as x86....etc., as stated I am very new to this and I have no idea what you are talking about.

Re: voice [Re: starr] #216327 09/11/09 04:11 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
on @10:text:!working:#thePlace: .mode $chan +v $nick
on *:text:!add*:*: work add $nick $2-
on *:text:!rem*:*: work rem $nick $2-
alias -l work {
if $2 == Scarlot[BOT] {
var %nicks = $replace($3-,$chr(44),$chr(32)), %a = 1, %b = $numtok(%nicks,32)
while %a <= %b {
$iif($1 == add,.auser -a,.ruser) 10 $gettok(%nicks,%a,32)
inc %a
}
}
}

The above is what I put in. Then I try entering a nick by typing in !add John. Nothing seems to happen, and when John types !working, it does not plus him. Any suggestions as to what I am doing wrong? Do I have to type !add .John?
Also, can any owner or op add to this by typing the command to the bot?


Last edited by starr; 09/11/09 04:16 PM.
Re: voice [Re: starr] #216328 09/11/09 04:47 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You did it correctly. The reason it didn't work, is because of an error I made in the code.
Change
Code:
on *:text:!add*:*:  work add $nick $2-
on *:text:!rem*:*:  work rem $nick $2-
to
Code:
on *:text:!add*:*:  work add $me $2-
on *:text:!rem*:*:  work rem $me $2-

That should fix it up. Sorry.

Re: voice [Re: s00p] #216329 09/11/09 04:56 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If I'd wanted to, I could've suggested that the OP read the help file and figure it out themselves, but as I have the knowledge, and it wasn't that difficult to code, I didn't mind providing the code.
In fact, to the best of my knowledge, what you are suggesting would require a lot more work than just having the OP try to figure out how to do what they wanted.

While it has been several years since I worked with a real programming language, I do have knowledge and experience with Fortran, and Cobol. But as neither of these is directly related to the request for a mIRC script, I stuck to using mIRC coding.

Quote:
Perhaps a better exercise would be to write an x86 assembly interpreter in mIRC
You want to do that, then post your code at an appropriate place so that I, and others, can review and comment? If so, I await seeing the post.

Moderators: Please excuse this small rant, I don't do it often, but felt, in this case, it was justified. If you disagree and remove the post, I do understand.

Re: voice [Re: RusselB] #216330 09/11/09 05:33 PM
Joined: Mar 2008
Posts: 33
S
starr Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2008
Posts: 33
Russell....Thank you so much...it works perfectly!

Re: voice [Re: RusselB] #216367 10/11/09 11:32 PM
Joined: Jul 2008
Posts: 236
S
s00p Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
I was merely trying to provide some advice for a user that seemed eager to learn. I have no desire to prove any point to you or anyone else here, so go have your way with someone elses leg.

Re: voice [Re: chacha] #216532 18/11/09 08:01 AM
Joined: Nov 2009
Posts: 117
gooshie Offline
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
Code:
on @voiced:text:!working:#:.mode # +v $nick
on $*:text:/^!(add\b|rem\b)/iS:#:xvoice $regml(1) $nick $$2-
alias -l xvoice {
  if $2 = starr {
    var %i 1,%n
    while $gettok($3-,%i,32) {
      %n = $v1
      if (%n ison #) $iif($1 = add,.auser -a,.ruser) voiced %n
      inc %i
    }
  }
}

Re: voice [Re: gooshie] #216536 18/11/09 02:24 PM
Joined: Nov 2009
Posts: 117
gooshie Offline
Vogon poet
Offline
Vogon poet
Joined: Nov 2009
Posts: 117
Change on text event to:

Code:
on $*:text:/^!(add|rem) (.+)/iS:#:xvoice $regml(1) $nick $regml(2)