Basics Class
Posted by Fubar
Sunday, July 24, 2005
Description: Basics Class of #script

Welcome to #script's first "Basics of mIRC scripting involving scripts for clan and channel management" class.  The class name itself is a mouthful so we'll just call it the Basics class.  This class teaches you the most frequently used scripts that clans use for their channels or for advertising.  This includes:
    Join/Part banners
    Simple advertisement timers
    Simple clanbots
    Grabbing news off the website
This is just the many topics we will cover today.  If you want a full list of the topics, go to http://fubar.is-a-geek.com/scriptclass.html.  The site has a list of the topics and who will be teaching them and when they will be taught.

There are a few useful scripts that you might need for this lesson.  For the "Sockets" portion where you grab news off of your website, you may need the HTML code stripper:

alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $replace(%x,  ,$chr(32))
  var %i = $pos(%x,&,1)
  while (%i) {
    var %entity = $gettok($mid(%x,$calc(%i +1)),1,59)
    var %char
    if ($left(%entity,2) == #x) {
      set %char $chr($base($right(%entity,-2),16,10))
    }
    elseif ($left(%entity,1) == $eval(#,0)) {
      set %char $chr($right(%entity,-1))

    }
    else {
      set %char $readini(entities.ini,entities,%entity)
    }
    if (%char != $null) {
      set %x $+($left(%x,$calc(%i -1)),%char,$mid(%x,$calc(%i + $len(%entity) +2)))
    }
    inc %i
    set %j $pos($mid(%x,%i),&,1)
    if (!%j) { break }
    set %i $calc(%i + %j -1)
  }
  if (st $+ $chr(41) $+ $chr(32) isin %x) {
    var %x $remove(%x,st $+ $chr(41) $+ $chr(32)
    return %x
    halt
  }
  return %x
}


This one does more than strip the code from what you get from a website but you won't need to know what that is or how the code works, if you would like a full explaination of the code, feel free to PM me.

If you want just the simple one, here it is:

alias nohtml {
var %parsed, %regex = $regsub($1-,m~([^<]*>|<[^>]+>|<[^>]*)|( )~g,$chr(32),%parsed)
return %parsed
}


Please stay for most of the class if you're going to attend, you may leave during the middle where the more complicated stuff is going to be taught.  This includes but is not limited to:
    Sockets
    HelpServ
    Shoutcast Scripts
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world