QuakeBot Script v0.2 by OrFeAsGr

By OrFeAsGr on May 06, 2016

SCRIPT ID: QUAKES
QuakeBot Script v0.2 Is Fully Scripted by OrFeAsGr - http://humanity.ucoz.com -
This is a bot script that sends the most recent earthquakes globally or near some places you choose!
Features:
-Sends new earthquakes to the channel you choose in the network you choose
-Map Link That points to the epicenter of the earthquake
-Magnitude and Epicenter Location
-You can filter the earthquakes that the bot sends by magnitude (from 2+ to 8+)
-You can make the bot send only earthquakes that occure near a place of your choice (from a given list of places)
-Filter and place settings commands are used only by a list of nicks you set
Commands:
All users can use it:
!stats
Response: Bot Sends Stats Of EarthQuakes (today, last 7 days, last month, last year)
Only Masters Nicks Can use:
!filter <2-8> | none
Usage: the 1st and only parameter should be a number from 2 to 8 or none (for no filter)
it sets the magnitude filter to that number
!places
Response: Lists of places you can set the bot to look for near eartquakes
!near
Usage: The 1st and only parameter should be a place from the list or "none" (without " ") for global earthquakes.
!qfeed on/off
The parameter can be either on or off. it sets on or off the timer that checks for new earthquakes i.e the scripts main purpose.
!qmasters- nick
Removes the nick from the masters list
!qmasters+ nick
Adds the nick to the masters list

I think it's a usefull script for an IRC channel! Have fun tracking earthquakes! Share the link if you share this script! Don't remove the adv message if you'd like!
-OrFeAsGr-
(The site that is used for this script is http://earthquaketrack.com )

;;;;;;;;QuakeBot Script by OrFeAsGr - http://humanity.ucoz.com -;;;;;;;;
;;;;;;;;Version: v0.2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;24/6/16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; http://hawkee.com/snippet/17015/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ON *:SOCKOPEN:quake: { if ($sockerr) { echo -at Error while retrieving earthquake info... | sockclose $sockname } | sockwrite -nt $sockname GET $+($iif(%cplaceq, $gettok(%placesquakelinks,$findtok(%placesquake,%cplaceq,1,126),126), $null),/recent,$iif(%filterquakes && %filterquakes != None, $+(?mag_filter=,$v1), $null)) HTTP/1.1 | sockwrite -nt $sockname User-Agent: Mozilla/4.0 | $iif(%etag, sockwrite -nt $sockname If-None-Match: %etag, $Null) | sockwrite -nt $sockname Host: earthquaketrack.com | sockwrite $sockname $crlf }

ON *:SOCKREAD:quake: {
if (!%QUAKESversion) || (%QUAKESversion != v0.2) { set %QUAKESversion v0.2 }
  if ($sockerr) { echo -at Error while retrieving earthquake info... | sockclose $sockname }
  var %quake
  sockread %quake
  if (*Places Near* iswm %quake) {
    if (!%magndepth) {
      if (!%bchose) {
        set -u225 %bchose 1
        .timer 1 1 msg %chanquake You Have Chosen A Combination Of Place And/Or Filter Which Doesn't Result To Any Recorded Events. Please lower the Magnitude Filter Or Wait For Such Event To Occure! :)
      }
    }
  }
  ; http://humanity.ucoz.com ;
  if (ETag: "*"  iswm %quake) {
    set %etag $gettok(%quake,2,32)
  }
  if (HTTP/1.1 304* iswm %quake) {
    sockclose $sockname
  }
  if (*earthquakes today* iswm %quake) || (*earthquakes in the past* iswm %quake) {
    inc %statsc 1
    set -u15 %nstats $replace($addtok(%nstats,$remove($replace($gettok(%quake,1-,32),$chr(44),.),<li>,</li>),44),$chr(44),$+($chr(44),$chr(32)))
    if (%statsc == 4) {
      unset %statsc 
      if (%lstats != %nstats) {
        set %lstats %nstats
      }
    }
  }
  if (*abbr class="timeago"* iswm %quake) {
    if (!%quaketstop) {
      set %quaketstop 1
      var %ntime = $replace($remove($gettok(%quake,3,32),title=",Z,">),T,$chr(32)) UTC
      if (%ntime == %lastqtime) {
        unset %quake*
        sockclose $sockname
      }
      elseif (%ntime != %lastqtime) {
        set %lastqtime %ntime
      }
    }
  }
  if (*magnitude*depth* iswm %quake) {
    set %magndepth $gettok($gettok($remove(%quake,$chr(44)),3,62),1,60) $gettok($gettok(%quake,2,44),1,60)
  }
  if (*a href="/*/recent*</a* iswm %quake) {
    if (%magndepth) && (!%gloccc) {
      inc %quakecountloc 1
      if (%quakecountloc < 4) {
        var %at = $gettok($gettok(%quake,2,62),1,60)
        set %quakeloc $replace($addtok(%quakeloc,%at,44),$chr(44),$+($chr(44),$chr(32)))
      }
    }
  }
  if (*Location:* iswm %quake) {
    set %gloccc epir
  }
  if (%gloccc == epir) && (*Location:* !iswm %quake) {
    var %g = $gettok(%quake,3-,32)
    set %quakelat $remove($gettok(%g,1,44),$chr(32))
    set %quakemag $remove($gettok(%g,2,44),$chr(32))
    set %gloccc qdist
  }
  if (%gloccc == qdist) {
    if (*m from* iswm %quake) {
      set %quakedist %quake
      sockclose $sockname
      unset %gloccc 
      set %lastquakemsg $iif(%filterquakes && %filterquakes != None, 3Filter14:7 $v1, $null) $iif(%cplaceq, 3Tracking Near14:7 $v1 $+($chr(03),03,$chr(124)), $null) 7 Date&Time14: %lastqtime 7 Magnitude & Depth14: %magndepth 7Epicenter14: $+(http://maps.google.com/maps?q=loc:,%quakelat,$chr(44),%quakemag,&z=7) %quakedist %quakeloc
      msg %chanquake 14-3EarthQuake Feed14- $iif(%filterquakes && %filterquakes != None, 3Filter14:7 $v1, $null) $iif(%cplaceq, 3Tracking Near14:7 $v1 $+($chr(03),03,$chr(124)), $null) 7 Date&Time14: %lastqtime 7 Magnitude & Depth14: %magndepth 7Epicenter14: $+(http://maps.google.com/maps?q=loc:,%quakelat,$chr(44),%quakemag,&z=7) %quakedist %quakeloc
      if (!%delayquakeadv) {
        set -u1000 %delayquakeadv 1
        .timer 1 5 msg %chanquake 3Quake14-3Bot Script By 7OrFeAsGr14!!! - http://humanity.ucoz.com -
      }
      unset %quake* %magndepth
    }
  }
}

ON *:TEXT:*:#: {
  if ($chan == %chanquake) {
    if ($strip($1) == !stats) {
      if (!%saystatsquake) {
        set -u100 %saystatsquake 1
        msg %chanquake %lstats
      }
    }
    if ($istok(%mastersquake,$nick,32)) {
      if ($strip($1) == !filter) {
        if ($strip($2) isnum 2-8) || ($strip($2) == None) {
          if (%filterquakes != $strip($2)) {
            .timer 1 1 msg $chan 7Changed Filter From4 $iif(%filterquakes, $iif($v1 != None, $+($v1,+), $v1), None) 7to3 $iif($strip($2) != None, $+($strip($2),+), $strip($2)) 7magnitude. $iif(%cplaceq, $+($chr(40),$chr(03),07,Place,$chr(03),14,:,$chr(32),$chr(03),03,$v1,$chr(15),$chr(41)), $null)
            set %filterquakes $strip($2)
          }
          elseif (%filterquakes == $strip($2)) {
            .timer 1 1 msg $chan 7Magnitude Filter Is Already3 $strip($2)
          }
        }
      }
      if ($strip($1) == !qfeed) {
        if ($strip($2) == off) {
          if ($timer(quake).secs) { .timer 1 1 msg $chan 7EarthQuake Tracking Is Now 4Off14! | .timerquake off }
          elseif (!$timer(quake).secs) { .timer 1 1 msg $chan 7Eartquake Tracking Is Already4 Off14! }
        }
        elseif ($strip($2) == on) {
          if (!$timer(quake).secs) { .timer 1 1 msg $chan 7EarthQuake Tracking Is Now 3On14! | .timerquake 0 45 sockopen quake earthquaketrack.com 80 }
          elseif ($timer(quake).secs) { .timer 1 1 msg $chan 7Eartquake Tracking Is Already3 On14! }
        }
      }
      if ($strip($1) == !qmasters-) {
        if ($istok(%mastersquake,$strip($2),32)) {
          set %mastersquake $remtok(%mastersquake,$strip($2),1,32)
          .timer 1 1 msg $chan $strip($2) Was Removed From Quake-Masters!
        }
      }
      if ($strip($1) == !qmasters+) {
        if (!$istok(%mastersquake,$strip($2),32)) {
          set %mastersquake $addtok(%mastersquake,$strip($2),32)
          .timer 1 1 msg $chan $strip($2) Was Added In Quake-Masters!
        }
      }
      if ($strip($1) == !places) {
        .timer 1 1 msg $chan Places: $replace(%placesquake,$chr(126),$+($chr(44),$chr(32)))
        .timer 1 2 msg $chan You can set me to track earthquakes near any of these places! Type !near <place> (type "!near none" (without ") to set it to global tracking (Default))
      }
      if ($strip($1) == !near) {
        if ($istok(%placesquake,$strip($2-),126) == $true) {
          if (%cplaceq != $strip($2-)) {
            .timer 1 1 msg $chan 7Changed Place From4 $iif(%cplaceq, $v1, None) 7To3 $strip($2-) . $iif(%filterquakes && %filterquakes != none, $+($chr(40),$chr(03),07,Magintude Filter,$chr(03),14,:,$chr(32),$chr(03),03,$v1,$chr(15),$chr(41)), $null)
            set %cplaceq $strip($2-)
          }
          elseif (%cplaceq == $strip($2-)) {
            .timer 1 1 msg $chan 7Place Is Already3 %cplaceq
          }
        }
        elseif ($istok(%placesquake,$strip($2-),126) == $false) && ($strip($2-) != None) {
          .timer 1 1 msg $chan 4False3 Argument14,3This Place Is Not On The List! Do !places to see the list!
        }
        elseif ($strip($2-) == None) {
          .timer 1 1 msg $chan 7EarthQuakes Will Now Be Tracked Globally14! $iif(%filterquakes && %filterquakes != None, $+($chr(40),$chr(03),07,Magintude Filter,$chr(03),14,:,$chr(32),$chr(03),03,$v1,$chr(15),$chr(41)), $null)
          unset %cplaceq
        }
      }
    }
  }
}

ON *:JOIN:#: {
  if ($chan == %chanquake) {
    if ($nick != $me) {
      if (%joinquake) {
        if (!$($+(%,recjoin,$address($nick,2)),2)) {
          set -u500 $+(%,recjoin,$address($nick,2))
          notice $nick Hey $nick ! Welcome to $+($chan,!) Last EarthQuake That Occured Is: %lastquakemsg
          notice $nick New Events Are Sent With A Channel Message! Thanks for the support! (QuakeBot by OrFeAsGr) http://humanity.ucoz.com
        }
      }
    }
    elseif ($nick == $me) {
      .timer 1 2 sockopen quake earthquaketrack.com 80
      .timerquake 0 45 sockopen quake earthquaketrack.com 80
      msg $chan 7,3Let's track some earthquakes14...7,3Shall we14? 
    }
  }
}

ON *:LOAD: {
  if (!placesquake) {
    set %placesquake LA and Southern California~Northern California~San Francisco Bay Area, California~The Pacific Northwest~South America~The Caribbean and Central America~Southeast Asia~Europe~Asia~The Middle East~Southern and Central Africa~Japan~New Zealand~United States~Greece~British Columbia~California~Oklahoma~Texas
  }
  if (!%placesquakelinks) {
    set %placesquakelinks /v/la~/v/norcal~/v/sf~/v/pnw~/v/southamerica~/v/caribbean~/v/seasia~/v/europe~/v/asia~/v/middleeast~/v/safrica~/p/japan~/p/new-zealand~/p/united-states~/p/greece~/p/canada/british-columbia~/p/united-states/california/~/p/united-states/oklahoma~/p/united-states/texas
  }
  if (!%netquake) { set %netquake $?="-QuakeBot- Please enter the network you want the QuakeBot Script to work in" }
  if (!%chanquake) { set %chanquake $?="-QuakeBot- Please enter the channel you want the QuakeBot Script to work in" }
  if (!%mastersquake) { set %mastersquake $?="-QuakeBot- Please enter the nicks which you want QuakeBot to listen to for settings" }
  echo -at 3The Script Will Now Work At 7Network14: %netquake 3And 7Channel14: %chanquake
}

ON *:START: {
  var %y = $?!="-QuakeBot- Do you want to connect to %netquake and join %chanquake for the QuakeBot Script to work?"
  if (%y == $true) { server -m %netquake 6667 -j %chanquake }
  else { echo -at QuakeBot Script By OrFeAsGr - http://humanity.ucoz.com - }
}

ON *:EXIT: {
if (%delayquakeadv) { unset %delayquakeadv }
}

;;;;;;;;QuakeBot Script by OrFeAsGr - http://humanity.ucoz.com -;;;;;;;;
;;;;;;;;Version: v0.1b;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;09/05/16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; http://hawkee.com/snippet/17015/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Do you want to help me make some money? You can do it without paying for nothing! Just visit my site http://humanity.ucoz.com ,turn off your ad blocker, watch an ad and turn it back on! You'll be giving me something less than a cent! Thanks!

Or do you want to donate some bucks because you like my scripts??? Visit https://www.paypal.me/OrFeAsGr
Thx! ^_^

Comments

Sign in to comment.
dma   -  May 08, 2016

how do i get it started up i filled in the blanks

dma  -  May 08, 2016

i joined my network but is used my alterantive nick to use it .. dont worry about it i'll unload it.. thanks for your time

OrFeAsGr  -  May 09, 2016

Hey! :)
You get a Yes/No window for connecting to the network you set when you Load the script.
You can delete lines 186 to 190 to stop this whenever mIRC starts.

Sign in to comment

OrFeAsGr   -  May 08, 2016

Latest change(s) below:
v0.1b
14/6/2016
-Added ID and version for Update checker!

dma  -  May 13, 2016

this script is working fine.. i like your stuff... but people are like why are you into earthquakes? i say i interested lol..

OrFeAaGr : can u make a baseball script? from !mlb like that?? get back to me please....dma irc.axon.pw #irc

Sign in to comment

OrFeAsGr   -  May 06, 2016

For Full Image Click Here> http://humanity.ucoz.com/earthquakes.png
Image

dma  -  Aug 27, 2016

this is running very well , i was wondering if you could make one for tornadoes plz

thanks dma irc.axon.pw #irc

dma  -  Oct 16, 2017

DOES THIS STILL WORK DUDE?

Sign in to comment

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.