;########################################################## ;## Multi Socket Price Script ## ;## Coded by : Crossfire39 ## ;## Uses multiple sockets so several users can use the ## ;## code at the same time. Also displays multiple ## ;## results from zybez.net price database. ## ;## Usage: ## ;## !Price - Private ## ;## @Price - Public ## ;########################################################## on $*:text:/^[!@]price(s|check)*/Si:#: { if ( !$2 ) { notice $nick Sorry you must specify what to search for - !price } else { /var %number 1 while ($sock(price.socket. $+ %number)) { /inc %number } if (!* iswm $1) { /set %price.displaystyle. [ $+ [ %number ] ] private } /set %price.item. [ $+ [ %number ] ] $2- /set %price.nick. [ $+ [ %number ] ] $nick /set %price.chan. [ $+ [ %number ] ] $chan /sockopen $+(price.socket.,%number) zybez.net 80 } ;Closes Else } ;Ends the !pricecheck section on *:sockopen:price.socket.*:{ sockwrite -nt $sockname GET /priceguide.php?search_terms= $+ $replace(%price.item. [ $+ [ $right($SockName,-13) ] ] ,$chr(32),$chr(43)) $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1 sockwrite -nt $sockname Host: zybez.net sockwrite -nt $sockname $crlf $crlf } on *:sockread:price.socket.*:{ var %i $right($sockname,-13) if ($sockerr) { /notice %price.nick. [ $+ [ %i ] ] Sorry but an error occured while searching for %price.item. [ $+ [ %i ] ] | halt } else { var %temptext sockread %temptext ;Once bot gets the Item + Price which is represented my %readnextline == 2, it runs this to display the results for the user then restarts the whole proccess. if (%readnextline == 2) { /inc %price.displayed. [ $+ [ %i ] ] /var %price.displayprice $htmlfree(%temptext) /var %message %price.displayitem. [ $+ [ %i ] ] - %price.displayprice /unset %readnextline ; Limits how many items are displayed before it stops reading. Prevents the bot from flooding. if ( %price.displayed. [ $+ [ %i ] ] < 6 ) { if ( %price.displaystyle. [ $+ [ %i ] ] == private ) { /notice %price.nick. [ $+ [ %i ] ] %message } else { /msg %price.chan. [ $+ [ %i ] ] %message } } ; Closes if statement - if ( %price.displayed. [ $+ [ %i ] ] < 6 ) else { /notice %price.nick. [ $+ [ %i ] ] Sorry but your search for " $+ %price.item. [ $+ [ %i ] ] $+ " was not specific enough. Please narrow your searh down, ie: Rune --> Rune Platelegs | /sockclose $+(price.socket.,%i) | /unset %price.*. [ $+ [ %i ] ] } } ; Closes if statement - if (%readnextline == 2) if (%readnextline == 1) { /set %price.displayitem. [ $+ [ %i ] ] $htmlfree(%temptext) | /set %readnextline 2 } if ( * isin %temptext) { /set %readnextline 1 } if (*Your search did not * iswm %temptext) { /notice %price.nick. [ $+ [ %i ] ] Sorry I did not find " $+ %price.item. [ $+ [ %i ] ] $+ " in the Zybez database. Please make sure you spelled everything correctly and the item you are searching for exists in Runescape. } } ; Closes else } ;Ends the sockread section on *:sockclose:price.socket.*:{ /unset %price.*. [ $+ [ $right($SockName,-13) ] ] } alias -l htmlfree { ; Cleans all html from a file var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) return %x } ;Ends the html cleaner alias ------------------------------------------------------------------------------------------------------------- alias c1 { return $+($1-,) } alias c2 { return $+($1-,) } on *:text:*:#: { tokenize 32 $strip($1-) if ($left($1,1) !isin @!.) halt if ($right($1,-1) == stats) var %style = astats elseif ($regex($1,/co?mb(at)?/Si)) var %style = combat elseif ($setskill($remove($1,@,!,.))) var %style = istat, %skill = $setskill($remove($1,@,!,.)) elseif ($right($1,-1) == setrsn) && ($2) { if ($2 == -h) { writeini DefRSN.ini RSNs $mask($fulladdress,3) $replace($3-,$chr(32),-) .notice $nick You're default RSN for the host $mask($fulladdress,3) has been set to $3- } else { writeini DefRSN.ini RSNs $nick $replace($2-,$chr(32),-) .notice $nick You're default RSN for the nick $nick has been set to $2- } halt } else halt inc %ID if ($len($2-) > 12) { $($+(%,stats.display.,%ID),2) $c1(The nick) $c2($2-) $c1(is too long) cleanup %ID halt } elseif ($2) set $+(%,stats.rsn.,%ID) $replace($2-,$chr(32),-) elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) set $+(%,stats.rsn.,%ID) $ifmatch elseif ($readini(DefRSN.ini,RSNs,$nick)) set $+(%,stats.rsn.,%ID) $ifmatch else set $+(%,stats.rsn.,%ID) $nick set $+(%,stats.style.,%ID) %style set $+(%,stats.skill.,%ID) %skill set $+(%,stats.display.,%ID) $iif($left($1,1) == @,msg $chan,notice $nick) sockopen $+(stats.,%ID) hiscore.runescape.com 80 } on *:sockopen:stats.*: { var %id = $gettok($sockname,2,46) sockwrite -n $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ $($+(%,stats.rsn.,%ID),2) HTTP/1.1 sockwrite -n $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf } on *:sockread:stats.*: { sockread &Incoming bwrite $sockname -1 -1 &Incoming if ($bfind(&Incoming, 1, ).text) makehash $sockname elseif ($bfind(&Incoming, 1, does not feature in the hiscores.).text) { $($+(%,stats.display.,%ID),2) $c1(The nick) $c2($($+(%,stats.rsn.,%ID),2)) $c1(Does not appear in the hiscores) cleanup $gettok($sockname,2,46) } } alias -l makehash { var %file = $1 bread %file 1 $file(%file).size &stats var %currentstat, %x = 1 while (%x) { var %x = $bfind(&stats,$calc(%x + 1),1,1•5,1•4,5•5,4•7,4•4,7•8,7•7,8•0,8•8,0• .Fire: /topic $chan 8,0æ0,8æ7,8æ8,7æ4,7æ7,4æ5,4æ4,5æ1,5æ5,1æ8,1 $?="Enter Topic Text" 5,1æ1,5æ4,5æ5,4æ7,4æ4,7æ8,7æ7,8æ0,8æ8,0æ .White-r: /topic $chan 0,12æ¸2,12`æ12,2æ¸1,2`æ2,1æ¸4,0 -= $?="Enter Topic Text" =- 2,1`æ1,2æ¸12,2`æ2,12æ¸0,12`æ .White-b: /topic $chan 0,12æ¸2,12`æ12,2æ¸1,2`æ2,1æ¸12,0 -= $?="Enter Topic Text" =- 2,1`æ1,2æ¸12,2`æ2,12æ¸0,12`æ .Black: /topic $chan 3,1\1,3\9,3\3,9\0,9\9,0\0,0-15,0\0,15\14,15\15,14\1,14\14,1\1,1-0,1 $?="Enter Topic Text" 1,1-14,1/1,14/15,14/14,15/0,15/15,0/0,0-9,0/0,9/3,9/9,3/1,3/3,1/ .Red: /topic $chan 4,0%0,4%4,4 5,4%4,5%5,5 1,5%5,1%1,1 0,1 $?="Enter Topic Text" 5,1%1,5%5,5 4,5%5,4%4,4 0,4%4,0% .Blue: /topic $chan 12%0,12% 2%12,2% 1%2,1%0 $?="Enter Topic Text" 2%1,2% 12%2,12% 0%12,0% } On *:TEXT:!Flowers*:#: { /notice $2 0.......4@0......12Roses /notice $2 0.....10@14|15@0.....9For /notice $2 0.......12)7|12(0.....4You /notice $2 0......13(12__13)0... 6 $2 }