mIRC Homepage
Posted By: starr voice - 07/11/09 08:48 PM
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.
Posted By: Tomao Re: voice - 07/11/09 11:52 PM
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.
Posted By: RusselB Re: voice - 08/11/09 12:01 AM
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.
Posted By: starr Re: voice - 08/11/09 02:03 AM
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
Posted By: RusselB Re: voice - 08/11/09 05:33 AM
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
Posted By: chacha Re: voice - 08/11/09 08:54 PM
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)
Posted By: s00p Re: voice - 09/11/09 10:31 AM
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
Posted By: starr Re: voice - 09/11/09 03:46 PM
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.
Posted By: starr Re: voice - 09/11/09 04:11 PM
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?

Posted By: RusselB Re: voice - 09/11/09 04:47 PM
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.
Posted By: RusselB Re: voice - 09/11/09 04:56 PM
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.
Posted By: starr Re: voice - 09/11/09 05:33 PM
Russell....Thank you so much...it works perfectly!
Posted By: s00p Re: voice - 10/11/09 11:32 PM
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.
Posted By: gooshie Re: voice - 18/11/09 08:01 AM
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
    }
  }
}
Posted By: gooshie Re: voice - 18/11/09 02:24 PM
Change on text event to:

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