Broadcast

By xelent on Jun 24, 2008

This a broadcast script for bots, it's like an amsg but broadcast means to send out information by a bot.

Command:
$broadcast [message]

The command is only for operators, but you can fix that if not /q me

;-----------------------------------------------------------------------------------
;   Broadcast by Andreas Moen a.k.a xelent
;   xelent@online.no;
;   13:37 15. December 2007;
;-----------------------------------------------------------------------------------

on *:TEXT:$broadcast *:#:{
  if ($nick isop $chan) { 
    Var %x = 1, %y = $Chan(0)
    Var %z = #chan #chan #chan
    While (%x <= %y) {
      If ($Chan(%x) !isin %z) {
        Msg $Chan(%x) (Broadcast) $2-
      }
      Inc %x
    }
  }
  else {
    .notice $nick You don't have access for this command.
  }
}

Comments

Sign in to comment.
PATX   -  Mar 15, 2009

good script.... u got some coding issues though. give it a 5

 Respond  
guest598594   -  Jun 26, 2008

Yea, you can only do [ quote ], not a specific name. By the way, you can edit comments now, so you can fix your original quote to work :)

if (!$regex(%z,\\$$chan(%x)^)) {

May wanna check tht, but i think it should work lol

You mixed it up, ^ starts it and $ ends it, and you escaped the wrong $

 Respond  
Bouncer   -  Jun 26, 2008

Ok, so it does work, just not a targeted quote? OR maybe I keyed it in wrong, too tired to double check myself.

 Respond  
Bouncer   -  Jun 26, 2008

Sorry for the double post, but they should make > work in comments -_-

I had forgotten it didn\'t, lol.

 Respond  
Bouncer   -  Jun 26, 2008

[QUOTE=xelent]This script works 100% stop complain :P[/QUOTE]

Lol, I wouldn\'t complain about the feedback you get. Alot of my posts on my old account never even got commented. Even some on this account haven\'t been. :)

 Respond  
Jonesy44   -  Jun 25, 2008
if (!$regex(%z,\\\\$$chan(%x)^)) {

May wanna check tht, but i think it should work lol

 Respond  
guest598594   -  Jun 25, 2008
This script works 100% stop complain :P

Well it does work, but not 100%. Like I said before, you could have the channel #test123 in the %z variable but be in the channel #test, and it won\'t do the broadcast.

 Respond  
EL   -  Jun 25, 2008

ROFL rite guna learn that fast round these parts:P

 Respond  
Typo   -  Jun 25, 2008

Woah man. Nobody complained once.

One of the main purposes of this snippet repository is for scriptors to get feedback on the code they share.

If you are not open to comments like those above than you should probably rethink posting here because you will always get them.

Nobody said it didnt work, we merely suggested ways of improving it.

 Respond  
xelent   -  Jun 25, 2008

This script works 100% stop complain :P

 Respond  
Typo   -  Jun 24, 2008

What would you think about maybe killing the %z = line and add on on load and menu option that uses a goto loop to add channels to the %z variable

for instance

on *:load:{ setchannels }
alias setchannels {
  if ($input(Would you like to add a channel?,y,Add a channel) == $true) {
    :addanother
    var %tmptmp = #$$?=\"Enter the channel name to be added.\"
    if (%tmptmp != $null) && ($istok(%z,%tmptmp,32) != $true) {
      %z = $addtok(%z,%tmptmp,32) 
    }
    if ($input(Would you like to add another channel?,y,Add a channel) == $true) { goto addanother }
  }
}

This seems sloppy to me but i tried a while ($input() != $true) line and it wouldnt work for me.

Honestly tho Im just trying to convey my idea, not make the best code I can.

Anyhoo then you could maybe even add a..

menu channel,query,status,nicklist { Set $chr(36) $+ Broadcast Channels:setchannels }

It did occur to me that you might also want to include a removechannels alias but making that from the example above would be pretty easy and im only trying to convey an idea here.

 Respond  
guest598594   -  Jun 24, 2008
    Var %z = #chan #chan #chan

I would say in the description that people need to put exception channels in there.

      If ($Chan(%x) !isin %z) {

I would use !$istok rather than !isin, because a restricted channel could be #test123 and #test would match. If you don\'t know what $istok does, it\'ll check if $chan(%x) matches one of the tokens in the %z variable (each channel in this case).

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.