mIRC Home    About    Download    Register    News    Help

Print Thread
A
Al_Bundy33
Al_Bundy33
A
I want this script to where i can type /horoscope <sign> and it show in the room i am in if anyone can help... would be greatly appreciated.

Thanks,
Al




on *:text:!horoscope*:#: {
if ($group(#horoscope).status == on) { msg $chan Please wait a few moments. }
if ($group(#horoscope).status == off) {
if ($istok(Aquarius.Pisces.Aries.Taurus.Gemini.Cancer.Leo.Virgo.Libra.Scorpio.Sagittarius.Capricorn,$2,46)) {
set %horosign $lower($2) | set %horochan $chan
sockopen horoscope shine.yahoo.com 80
.enable #horoscope
}
if (!$2 || !$istok(Aquarius.Pisces.Aries.Taurus.Gemini.Cancer.Leo.Virgo.Libra.Scorpio.Sagittarius.Capricorn,$2,46)) {
msg $chan Horoscope usage: !Horoscope <sign>
msg $chan Options: Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Capricorn
}
}
}
#horoscope off
on *:sockopen:horoscope: {
sockwrite -n $sockname GET /astrology/ $+ %horosign $+ /daily-overview/ HTTP/1.1
sockwrite -n $sockname Host: www.latimes.com
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:sockread:horoscope: {
sockread %horotemp
if (<h2> isin %horotemp) { inc %t 1 | set %horostuff $+ %t $remove($nohtml(%horotemp),$chr(9)) }
if (<p> isin %horotemp) { inc %u 1 | set %horostuffed $+ %u $remove($nohtml(%horotemp),$chr(9)) }
if (<h5> isin %horotemp) { set %horostuffing $remove($nohtml(%horotemp),$chr(9)) }
}
on *:sockclose:horoscope: {
msg %horochan Sign & Dates: $colored(%horostuffing $+($chr(40),$remove($replace(%horostuffed2,$(–),$chr(45)),$chr(32)),$chr(41)),7) Today: $colored($gettok(%horostuffed1,1,124),12)
msg %horochan Quickie: $colored(%horostuff1,3)
msg %horochan Overview: $colored(%horostuffed3,3)
unset %horo* %u %t %v
.disable #horoscope
}
; Usage: $colored(TEXT,N1,N2) or $colored(TEXT,N1,N2).b
; N1 & N2 are both optional.
alias colored { if ($isid) { return $+($iif($prop = b,$chr(2)),$iif($2 isnum 0-15,$+($chr(3),$iif($len($2) == 1,$+($chr(48),$2),$2))),$iif($3 isnum 0-15,$+($chr(44),$iif($len($3) == 1,$+($chr(48),$3),$3))),$1,$chr(15)) } }
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
#horoscope end


Joined: Nov 2006
Posts: 1,552
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,552
Urm, try "shine.yahoo.com" instead of "http://www.latimes.com" as the "Host:" wink

Other notes (glimpsed only):
- you could check for if ($sock(horoscope)) instead of switching a group
- you could /sockmark the $chan and <sign> -values instead of setting global variables for them.

smile


Link Copied to Clipboard