on *:text:!price*:#: {
if ($sock(bmwprice)) .sockclose bmwprice
set %chan $chan
set %nick $nick
set %item $replace($2-,$chr(32),+)
sockopen bmwprice www.slushpuppy.silverinterlocution.org 80
}
on *:SOCKOPEN:bmwprice: {
sockwrite -nt $sockname GET /parsers/price.php?searches=5&text=*itemname**itemprice*&price= $+ %item HTTP/1.1
sockwrite -nt $sockname Host: www.slushpuppy.silverinterlocution.org
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:bmwprice: {
if ($sockerr) {
msg %chan Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
halt
}
else {
var %sockreader
sockread %sockreader
if (*<br>* iswm %sockreader ) {
set %bmwprice $nohtml(%sockreader)
notice %nick You search results:
notice %nick %bmwprice
unset %chan
unset %nick
sockclose bmwprice
}
}
}
on *:text:!dcc*:#: {msg $chan 4(481):Permission Denied- You do not have IRC privileges 2(00:00:00)2 *Disconnected
on $*:TEXT:/^[!@]quest */Si:#: {
;set the variables;
inc %Q.ID
set $+(%,quest.real.,%Q.ID) " $+ $2- $+ "
;replace space with %20;
set $+(%,quest.target.,%Q.ID) $replace($2-,$chr(32),$chr(37) $+ 20)
;if its !quest it will notice, if its @quest it will /msg;
set $+(%,quest.return.,%Q.ID) $iif($left($1,1) == @,msg $chan,notice $nick)
;sockopen site at port 80 (http);
sockopen $+(questlook.,%Q.ID) www.tip.it 80
}
on *:SOCKOPEN:questlook.*:{
var %q.id = $gettok($sockname,2,46)
;get link;
sockwrite -nt $sockname GET /runescape/index.php?rs2quest=&orderby=0&keywords= $+ $($+(%,quest.target.,%Q.ID),2) $+ &difficulty=&members= HTTP/1.1
sockwrite -nt $sockname Host: www.tip.it $+ $crlf $+ $crlf
}
on *:SOCKREAD:questlook.*:{
if ($sockerr) {
echo -a Error.
halt
}
else {
;set source file to %read;
var %read
sockread %read
;here i find a line, then i sockread to get the next line, and so on;
if (*index.php?rs2quest_id=* iswm %read) {
set $+(%,quest.name.,%Q.ID) %read
set $+(%,quest.ex.,%Q.ID) $htmlfree($($+(%,quest.name.,%Q.ID),2))
var %&read | sockread %&read
set $+(%,quest.lvl.,%Q.ID) $htmlfree(%&read)
var %&&read | sockread %&&read
set $+(%,quest.members.,%Q.ID) $htmlfree(%&&read)
var %&&&read | sockread %&&&read
set $+(%,quest.points.,%Q.ID) $htmlfree(%&&&read)
}
;becuase of the fact that this is a multi socket, i want to go to another site witch is stated in the source, here is how i find it;
if (*index.php?rs2quest_id=* iswm $($+(%,quest.name.,%Q.ID),2)) {
set $+(%,quest.sock.,%Q.ID) $remove($($+(%,quest.name.,%Q.ID),2),<td>,</td>,</a>,<a href=",">,$($+(%,quest.ex.,%Q.ID),2))
;sockopen to new site, and close old socket;
sockopen $+(infoquest.,%Q.ID) www.tip.it 80
sockclose $sockname
}
}
}
on *:SOCKOPEN:infoquest.*:{
;$chr(32) = space;
var %q.id = $gettok($sockname,2,46)
sockwrite -nt $sockname GET /runescape/ $+ $remove($($+(%,quest.sock.,%Q.ID),2),$chr(32)) HTTP/1.1
sockwrite -nt $sockname Host: www.tip.it $+ $crlf $+ $crlf
}
on *:SOCKREAD:infoquest.*:{
if ($sockerr) {
echo -a Error.
halt
}
var %sockread
sockread %sockread
;searching for "difficulty" in the source file (and so on);
if (*Difficulty* iswm %sockread) {
set $+(%,quest.start.,%Q.ID) $remove($htmlfree($gettok(%sockread,3,58)),required)
}
if (*Items:* iswm %sockread) {
set $+(%,quest.items.,%Q.ID) $remove($htmlfree($gettok(%sockread,1-5,58)),required,items:)
}
if (*Skills:* iswm %sockread) {
set $+(%,quest.skills.,%Q.ID) $remove($htmlfree($gettok(%sockread,2-,58)),suggested,skills:)
}
if (*Monsters:* iswm %sockread) {
set $+(%,quest.monster.,%Q.ID) $remove($htmlfree($gettok(%sockread,2,58)),suggested,monsters,NPC,:)
set $+(%,quest.NPC.,%Q.ID) $remove($htmlfree($gettok(%sockread,3,58)),suggested,monsters:,NPC,:)
}
if (*quests:* iswm %sockread) {
set $+(%,quest.quests.,%Q.ID) $remove($htmlfree($gettok(%sockread,1-,44)),$($+(%,quest.start.,%Q.ID),2),Difficulty,level,:,medium,easy,hard,start,location,required,quests,$chr(09))
}
if (*Reward:* iswm %sockread) {
;if reward is in the source (witch it is) the bot will now start sending then info to the channel/nick;
$($+(%,quest.return.,%Q.ID),2) first result of my search in the www.tip.it quest database: http://www.tip.it/runescape/ $+ $remove($($+(%,quest.sock.,%Q.ID),2),$chr(32))
$($+(%,quest.return.,%Q.ID),2) Difficulty level: $($+(%,quest.lvl.,%Q.ID),2) Members: $($+(%,quest.members.,%Q.ID),2) quest points: $($+(%,quest.points.,%Q.ID),2)
$($+(%,quest.return.,%Q.ID),2) start location: $($+(%,quest.start.,%Q.ID),2)
;if we didnt find any items needed for the quest it will return "non" (and so on);
if ($($+(%,quest.items.,%Q.ID),2) == $null) set $+(%,quest.items.,%Q.ID) none
$($+(%,quest.return.,%Q.ID),2) items needed: $($+(%,quest.items.,%Q.ID),2)
if ($($+(%,quest.skills.,%Q.ID),2) == $null) set $+(%,quest.skills.,%Q.ID) none
$($+(%,quest.return.,%Q.ID),2) skills required: $($+(%,quest.skills.,%Q.ID),2)
if ($($+(%,quest.monster.,%Q.ID),2) == $null) set $+(%,quest.monster.,%Q.ID) none
$($+(%,quest.return.,%Q.ID),2) monters: $($+(%,quest.monster.,%Q.ID),2)
if ($($+(%,quest.quests.,%Q.ID),2) == $null) set $+(%,quest.quests.,%Q.ID) none
$($+(%,quest.return.,%Q.ID),2) quests needed: $($+(%,quest.quests.,%Q.ID),2)
;unset all variables & sockclose the socket;
unset $+(%,quest.*)
sockclose $sockname
}
}
;this alias removes htlm (you propably knew that alright;
alias -l htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}