mIRC Home    About    Download    Register    News    Help

Print Thread
#169136 19/01/07 08:12 PM
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Basically I just need to figure out how to make it slap everyone in the channel (in 1 line though, such as: Blabla slaps a b c d e f g around a with a slapall stick)

Of course I wouldn't mind if anyone would be so kind as to write out the entire script, but I think if I have the command to write down everyone in the channel I can figure the rest out myself.

Thanks in advance.

Joined: Nov 2005
Posts: 105
D
Vogon poet
Offline
Vogon poet
D
Joined: Nov 2005
Posts: 105
I doubt this is the best method, but it does work.
Code:
 alias slapall {
  set %tslap 1
  set %nslap $nick($chan,0)
  while (%tslap <= %nslap) {
    set %slapall  %slapall $nick($chan,%tslap) $+ ,
    inc %tslap
  }
  describe $chan slaps %slapall around with a slapall stick.
  unset %slapall
  unset %tslap
  unset %nslap
}
 

the usage is just /slapall in the channel. I'm sure someone will come up with something more efficient. My mind just isn't running fully.

drc4 #169139 19/01/07 08:34 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
I use this one. Also pretty basic, but does the trick.

Code:
.Mass slap:{
  var %nr_of_nicks = $nick($chan,0)
  var %total_nicks_that_will_be_slapped = $calc(%nr_of_nicks - 1)
  if (%total_nicks_that_will_be_slapped == 0) { echo 4 -a = $+ $time $+ = Dude, there is nobody to slap except yourself :/ }
  else {
    var %i = 1
    while (%i <= %nr_of_nicks) {
      var %nick_temp = $nick($chan,%i)
      if (%nick_temp == $me) { inc %i }
      else {
        var %nicks_slapped = $calc(%nicks_slapped + 1)
    var %nicks_to_slap %nicks_to_slap $+ %nick_temp $+ $iif(%nicks_slapped != %total_nicks_that_will_be_slapped, $Chr(44), $Chr(46)) | inc %i } }
    describe $chan spanks the shit out of %nicks_to_slap 8Time to wake up!!!!!!!!
  }
}

Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Ok I might not have been clear enough on this point. I need others to be able to issue the command as well.

Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Ok, thats simple enough.
Just put the code in an event.

Code:
on *:TEXT:!slap-all:#channel-name:{
  var %nr_of_nicks = $nick($chan,0)
  var %total_nicks_that_will_be_slapped = $calc(%nr_of_nicks - 1)
  if (%total_nicks_that_will_be_slapped == 0) { echo 4 -a = $+ $time $+ = Dude, there is nobody to slap except yourself :/ }
  else {
    var %i = 1
    while (%i <= %nr_of_nicks) {
      var %nick_temp = $nick($chan,%i)
      if (%nick_temp == $me) { inc %i }
      else {
        var %nicks_slapped = $calc(%nicks_slapped + 1)
    var %nicks_to_slap %nicks_to_slap $+ %nick_temp $+ $iif(%nicks_slapped != %total_nicks_that_will_be_slapped, $Chr(44), $Chr(46)) | inc %i } }
    describe $chan spanks the shit out of %nicks_to_slap 8Time to wake up!!!!!!!!
  }
}


Do !slap-all from #channel-name

Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Excellent, thank you very much. <3

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, neither of those take into account the maximum length you can have in a single message line, which could be a problem depending how many nicks are in the channel.

And, Orion... having } } at the end of a line in the middle of a script is a good way to run into mistakes, imo. smile

Here's how I would do it.

Code:
on *:text:!slapall:#yourchannel: {
  var %cnt = 1
  var %total = $nick($chan,0)
  while (%cnt <= %total) {
    if ($nick($chan,%cnt) != $me) {
      ; The $iif in here prevents having an extra comma at the end.
      var %slapnicks = $iif(%slapnicks,%slapnicks $+ $chr(44) $+ $nick($chan,%cnt),$nick($chan,%cnt))
      ; If the length is too long, do the first ~400 characters to begin with.
      if ($len(%slapnicks) > 400) {
        ; The first $iif checks to see if this is the first line of the split... you don't need "slaps" at the beginning of every single line.
        ; The second $iif will display the ending (with a large trout) if this happens to be the last nick that puts it over 400 characters.
        describe $chan $iif(!%split,slaps) %slapnicks $iif($calc(%cnt + 1) == %total,with a large trout.)
        var %split = $true
        unset %slapnicks
      }
    }
    inc %cnt
  }
  ; Display remaining nicks (or all if all of them are less than 400 characters).
  if (%slapnicks) { describe $chan %slapnicks with a large trout. }
}


That should work and should let you do this in channels with a lot of people in them as long as you don't have hundreds of people that would cause you to get flooded off by saying too many lines at once.

I threw in some comments to help explain it.

[EDIT] I fixed a mistake. If you tried this before seeing this edit line, then use this copy instead.

Last edited by Riamus2; 19/01/07 11:49 PM.

Invision Support
#Invision on irc.irchighway.net
Riamus2 #169153 19/01/07 10:50 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Yeah you're right. It wasn't the nicest form of scripting.
Anyway, I cant get your version to work tbh.

=23:31:10= * @me slaps
=23:31:10= * @me with a large trout.
* /describe: insufficient parameters (line 82, popups.ini)

And line 82, would be:
describe $chan $iif(!%split,slaps) %slapnicks $iif($calc(%cnt + 1) == %total,with a large trout.)

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try the updated one. I forgot a part when setting the %slapnicks variable.

If it still doesn't work, let me know and I'll check when I'm home and have access to testing it.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169156 19/01/07 11:12 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Same

=00:12:15= * @Me slaps
* /describe: insufficient parameters (line 82, popups.ini)

line 82 being:
describe $chan $iif(!%split,slaps) %slapnicks $iif($calc(%cnt + 1) == %total,with a large trout.)

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Fixed another mistake that I noticed. Sorry. I hate not being able to test something out. smile


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169159 19/01/07 11:29 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Well, we are getting closer:

=00:28:18= * @Me with a large trout.

No errors this time, just it also doesn't seem to set anything.
confused

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, I think I fixed the last error. (I hope) smile

I also made a change so that it wouldn't mess up if you were the only person in the channel.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169167 20/01/07 12:33 AM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Yeah, this is a lot better!

Nice one, as always laugh

Riamus2 #169172 20/01/07 01:35 AM
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
Awesome, works great. smile

One more question: Just for aesthetic purposes, how do I add a space after the comma? "slaps name1,name2,name3 with" just doesn't look as good as "slaps name1, name2, name3 with".

Last edited by Noeptolemos; 20/01/07 01:36 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Change the var %slapnicks line to this:

Code:
      var %slapnicks = $iif(%slapnicks,%slapnicks $+ $chr(44) $nick($chan,%cnt),$nick($chan,%cnt))



Invision Support
#Invision on irc.irchighway.net
Riamus2 #169179 20/01/07 02:02 AM
Joined: Dec 2005
Posts: 23
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2005
Posts: 23
You forgot the word 'slaps' after 'describe $chan' by the way. smile

And thanks again for all your help, really appreciated.

Last edited by Noeptolemos; 20/01/07 02:07 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Actually, that last line should be:

Code:
  if (%slapnicks) { describe $chan $iif(!%split,slaps) %slapnicks with a large trout. }



As the comment further up in the script says, this makes it so that you don't see slaps multiple times.

Example:
* Riamus slaps you, you, you, you, you, you
* Riamus you, you, you, you, you, you
* Riamus you, you with a large trout.

(If I could make it not show my nick when outputting it, I would, but this looks better imo than seeing slaps on every line).


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2003
Posts: 214
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 214
If you use a popup in the Nicklist for Slaps, select the nicks you want to slap and use this:

"Slap: me slaps $$snicks around a bit with a large trout"


one step closer to world domination

Link Copied to Clipboard