All pastes #1371292 Raw Edit

IGL-Bot Scripts

public text v1 · immutable
#1371292 ·published 2009-03-25 04:13 UTC
rendered paste body
; IGL-Bot Creds to Dawson(iTzIc0nic) And a HUGEEE Credit to MorganK for helping me fix up my messy code and make it work when
; I am so close, yet so far, I really need to work on the little things =p.

; USN Saving ;

On *:TEXT:!regusn*:#: { writeini usns.ini USNS $nick $2- | msg $chan Your USN is now saved, use !myusn to get your USN when you forget it }
; Simple enough remote, just writes the USN you give it to the .ini file usns.ini
on *:TEXT:!myusn:#: { msg $chan $readini(usns.ini,USNS,$nick) }
; Yet again simple, just reads from usns.ini finds your nick and returns your usn.

; Play Ranking ;

on *:Text:!ranking*:#: {
  sockclose USN1
  set %nick $nick
  set %chan $chan
  set %search $2
  sockopen USN1 clan.subagames.com 80
}
; Closes the exist socket if for some reason it is still open, sets some variables, and opens the sock that is needed.
on *:SOCKOPEN:USN1: {
  sockwrite -nt $sockname GET /charstat_cf.aspx?usn= $+ %search HTTP/1.1
  sockwrite -nt $sockname Host: clan.subagames.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:USN1: {
  if ($sockerr) {
    msg %chan Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    sockread %sockreader
    if (*Main_lbl_charactername* iswm %sockreader) {
      set %name $regml($regex(%sockreader,/Main_lbl_charactername">(.*?)</span>/Si))
      notice %nick 4Ingame Name:10 %name
    }
    if (*main_lbl_play_cnt* iswm %sockreader) {
      set %match1 $regml($regex(%sockreader,/main_lbl_play_cnt">(.*?)</span>/Si))
      notice %nick 4Total Matches:10 %match1
    }
    if (*Main_lbl_win_cnt* iswm %sockreader) {
      set %match2 $regml($regex(%sockreader,/Main_lbl_win_cnt">(.*?)</span>/Si))
      notice %nick 4Total Wins:10 %match2
    }    
    if (*Main_lbl_lose_cnt* iswm %sockreader) {
      set %match3 $regml($regex(%sockreader,/Main_lbl_lose_cnt">(.*?)</span>/Si))
      notice %nick 4Total Losses:10 %match3
    }
    if (*Main_lbl_enemy_kill_cnt* iswm %sockreader) {
      set %kills3 $regml($regex(%sockreader,/Main_lbl_enemy_kill_cnt">(.*?)</span>/Si))
      notice %nick 4Total Kills:10 %kills3
    }
    elseif (*Main_lbl_death_cnt* iswm %sockreader ) {
      set %kills4 $regml($regex(%sockreader,/Main_lbl_death_cnt">(.*?)</span>/Si))
      notice %nick 4Total Deaths:10 %kills4
    }
    elseif (*Main_lbl_headshot_kill_cnt* iswm %sockreader ) {
      set %kills5 $regml($regex(%sockreader,/Main_lbl_headshot_kill_cnt">(.*?)</span>/Si))
      notice %nick 4Total Headshots:10 %kills5
      sockclose USN1
      unset %nick
      unset %chan
    }
  }
}
; Grabs the actual info and notices the person who asked for the info, Contact me for further info if intrested in how it works.

; Clan Ranking (Very similar to how Player Ranking is formatted) ;

on *:Text:!clan*:#: {
  sockclose CLAN
  set %nick $nick
  set %chan $chan
  set %search $2
  sockopen CLAN clan.subagames.com 80
}
on *:SOCKOPEN:CLAN: {
  sockwrite -nt $sockname GET /clanstat_cf.aspx?guildid= $+ %search HTTP/1.1
  sockwrite -nt $sockname Host: clan.subagames.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:CLAN: {
  if ($sockerr) {
    msg %chan Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    sockread %sockreader
    if (*Main_lbl_clanname* iswm %sockreader) {
      set %name $regml($regex(%sockreader,/Main_lbl_clanname">(.*?)</span>/Si))
      notice %nick 4Clan Name:10 %name
    }
    if (*Main_lbl_ranking* iswm %sockreader) {
      set %Rank $regml($regex(%sockreader,/Main_lbl_ranking">(.*?)</span>/Si))
      notice %nick 4Clan Rank:10 %Rank
    }
    if (*Main_lbl_members* iswm %sockreader) {
      set %members $regml($regex(%sockreader,/Main_lbl_members">(.*?)</span>/Si))
      notice %nick 4Number Of Members:10 %members
    }    
    if (*Main_lbl_createddate* iswm %sockreader) {
      set %created $regml($regex(%sockreader,/Main_lbl_createddate">(.*?)</span>/Si))
      notice %nick 4Date Created:10 %created
    }
    if (*Main_lbl_minutesplayed* iswm %sockreader) {
      set %played $regml($regex(%sockreader,/Main_lbl_minutesplayed">(.*?)</span>/Si))
      notice %nick 4Minutes Played:10 %played
    }
    elseif (*Main_lbl_enemykill* iswm %sockreader ) {
      set %clankill $regml($regex(%sockreader,/Main_lbl_enemykill">(.*?)</span>/Si))
      notice %nick 4Clan Accumulated Kills:10 %clankill
    }
    elseif (*Main_lbl_death* iswm %sockreader ) {
      set %clandeath $regml($regex(%sockreader,/Main_lbl_death">(.*?)</span>/Si))
      notice %nick 4Clan Accumulated Deaths:10 %clandeath
      sockclose CLAN
      unset %nick
      unset %chan
    }
  }
}

; Again contact me if you have questions on how it works.

; Lastly, Channel Stats(This network doesn't use ~,&, or % but its easy to add to the formula) ;

on 500:Text:!cstat:*: {
  var %Max $nick($chan,0)
  var %I 1
  var %Regular 0
  var %Voice 0
  var %Halfop 0
  var %Op 0
  var %admin 0
  var %master 0  
  While ( %I <= %max ) {
    If ($left($nick($chan,[ %I ]).pnick,1) = ~) {
      inc %master
    }
    else If ($left($nick($chan,%I).pnick,1) = *) {
      inc %admin
    }
    else If ($left($nick($chan,%I).pnick,1) = @) {
      inc %op
    }
    else If ($left($nick($chan,%I).pnick,1) = %) {
      inc %halfop
    }
    else If ($left($nick($chan,%I).pnick,1) = +) {
      inc %voice
    }
    else {
      inc %regular
    }
    inc %I
  }
  msg $chan 3Channel stats for $chan 4( Requested by $nick )
  msg $chan This channel has $round($calc(($(%op)/$(%max))*100),0) $+ % 3IGL-Staff.
  msg $chan This channel has $round($calc(($(%voice)/$(%max))*100),0) $+ % 10Peons.
  msg $chan This channel has $round($calc(($(%regular)/$(%max))*100),0) $+ % 14Normal Users.
  msg $chan The topic is $chan($chan).topic
  msg $chan The modes set in this channel: $chan($chan).mode
}

; And thats the basics of IGL-Bot. :) ~Dawson/Help from MorganK ;