[OLD] Announce Script 1.0

By lavamike on Sep 14, 2007

Some Setup Required (You should know what your doing...)

If you type !a it sets in the announce, to view announcements type !announce and it supports multiple announcements...to delete announcements i didnt include because it's buggy...if you know what your doing you shouldn't have a problom...

;Announce Script Created By Lavamike

on *:TEXT:!announce*:#: { /msg $chan 4The Announcements Are:3 $read(A.txt)}

on <USERLEVEL>:TEXT:*:#: { 
  if ($1 == !a) { 
    if (!$2) { notice $nick Usage: !a <Item> } 
    var %i = $addtok($read(A.txt), $2- $20,32) 
    /write A.txt %i 4|-|3 
    notice $nick " $+ $2- $+ " has been stored in the announcements. To view the announcements please type !announce.
  }
}

Comments

Sign in to comment.
Joe_Dean   -  Oct 23, 2008

Why can't you /play the file to the user/chan instead of using loops and extra vars that you just don't need? :P

 Respond  
guest598594   -  Sep 16, 2007

well if theyre announcements, they must be important :P

 Respond  
napa182   -  Sep 16, 2007

eh why flood the channel thats if there are 10+ announcements

 Respond  
guest598594   -  Sep 16, 2007
on *:TEXT:!announce:#:{
  var %annouce = 1
  while (%announce <= $lines(a.txt) {
    msg $chan 4The Announcement %announce $+ :3 $read(A.txt) | inc %announce
  }
}

that can read all the announcements

 Respond  
napa182   -  Sep 14, 2007

or you can just do it this way but it\'s up too you...

on *:text:*:#: {
  if (($nick isop #) || ($nick ishop #)) {
    if (($1 == !announce) && (!$2)) {
      msg $chan Please select a announcement number 1 - $lines(A.txt)
    }
    elseif (($1 == !announce) && ($read(A.txt, n) == $null)) {
      msg $chan There Are No Announcement\'s At This Time.
    }
    elseif (($1 == !announce) && ($read(A.txt, n, $2) == $null)) {
      msg $chan Sorry $nick But That Announcement Number Does Not Exist. Please Pick A Announcement Number (1 -  $lines(A.txt) $+ )
    }
    elseif ($1 == !announce) {
      msg $chan Reading Announcement $2 of $lines(A.txt) $+ : $read(A.txt, n, $2)
    }
    elseif ($1 == !a) {
      write A.txt $2-  
      msg $chan Announcement:  $2- Has Been Added! As Announcement Number $lines(A.txt)
    }
    elseif ($1 == !dela) {
      msg $chan Deleteing Announcement Number $2 $+ : Of $read(A.txt, n, $2)
      write -dl $+ $2 A.txt
    }
    elseif (($1 == !counta) && ($lines(A.txt) == 0)) {
      msg $chan There Are No Announcement\'s To Count.
    }
    elseif ($1 == !counta) {
      msg $chan $nick I Have A Total Of $lines(A.txt) Announcement\'s So Far.
    }
  }
}
 Respond  
simplicity   -  Sep 14, 2007

This is moderate. There are a few errors I found though.

  1. $read(A.txt) will return a random line from your announcements. Try using this code:
var %x = 1
while (%x <= $lines(A.txt)) { 
 ; This line returns if the total number of lines in a text is more than 1
 .timer 1 2 msg $chan $read(A.txt,%x) | inc %x
 ; This line broadcasts to the channel the announcements with a timer. This is to prevent flooding. The $read(A.txt,%x) reads a specific line in the text. The %x varaible will add 1 to its current number each time. And until the events ends, it will keep on msging the channel with the %x line in the txt file.
}

Remove the ; comments if you end up using the code. I just wanted to explain what everything does. ;)

  1. There needs to be a space between the $read and the closing bracket.

  2. Remove the /\'s (not really an error). It\'s better coding that way. ;)

Other then that, nice idea. I recommend you add a feature to remove a specific line of text from the txt file.

 Respond  
lavamike   -  Sep 14, 2007

Thanks, Edited.

 Respond  
xDaeMoN   -  Sep 14, 2007

You can combine these 2 On Text events in 1 remote file, just make sure that you put the 2nd event (with the !announce) before the other.

Or better yet, combine them into just 1 On text event. Then use $level to determine the level of the user.

GL =)

 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.