on *:LOAD: {
set %c1 = 14
set %c2 = 07
set %c3 = 15
}
menu menubar,commands {
-
Price Script
.config:/priceconfig
}
alias -l htmlfree {
var %x = "", %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}
alias priceconfig {
echo -a * *********************************
echo -a * To set price options use the following commands:
echo -a * /priceall <on $+ $chr(124) $+ off> - Allows the use of the "all" trigger. (.price -a rune set returns rune (g) set, rune (t) set, and rune set.) Default is off due to flooding issues.
echo -a * /pricecolor <color1 color2 color3> - Sets colors of the output text. Default is 14 07 15 (looks like: 14Santa Hat:07 25,000,000gp |15 zybez.net)
echo -a * *********************************
}
alias priceall {
if ($1 == on) { set %priceall on | echo -a * Price All is now set to "on" | return Price All = On }
elseif ($1 == off) { set %priceall off | echo -a * Price All is now set to "off" | return Price All = Off }
else { echo -a * Invalid Syntax. Either /priceall on or /priceall off. | return Invalid Syntax }
}
alias pricecolor {
if ($len($1) == 2) && ($len($2) == 2) && ($len($3) == 2) && ($1 isnum) && ($2 isnum) && ($3 isnum) && ($1 <= 15) && ($2 <= 15) && ($3 <= 15) {
set %c1 $1 | set %c2 $2 | set %c3 $3
echo -a * Colors Set. Output will now look like below:
echo -a * $+ %c1 Santa Hat: $+ %c2 25,000,000gp $chr(124) $+ $+ %c3 zybez.net
}
else {
echo -a * Invalid color selection. Please use two digit color codes from 01 to 15.
}
}
;Do not change priceappend. Zybez will break the script again if you do. Feel free to shorten it, but give credit to zybez ALWAYS.
;if it breaks again because of this, I wont release a new update.
alias priceappend {
return $+(,%c3,,zybez.net)
}
on *:TEXT:!price*:#: {
if ($2 == -a) {
set %priceflag $2
set %rs.item $replace($3-,$chr(32),$chr(43))
}
else {
set %rs.item $replace($2-,$chr(32),$chr(43))
}
set %pricenick $nick
set %msg.type private
price
}
on *:TEXT:@price*:#: {
write -c pricedownload.txt
if ($2 == -a) {
set %priceflag $2
set %rs.item $replace($3-,$chr(32),$chr(43))
}
else {
set %rs.item $replace($2-,$chr(32),$chr(43))
}
set %pricechannel $chan
set %pricenick $nick
set %msg.type public
price
}
alias pricemsg {
if (%priceall == on) && (%priceflag == -a) {
var %itemnamecount 1
var %pricecount 2
while ($read(pricedownload.txt,1)) {
var %itemname $read(pricedownload.txt,1))
var %price $read(pricedownload.txt,2)
var %output $+ %c1 $+ %itemname $+ : $+ %c2 %price $+ %type $chr(124) $+ $+ %c3 $priceappend
if (spelling isin $read(pricedownload.txt,1)) { notice %pricenick $+(,%c2,Your) search did not return any results. Please make sure your spelling is correct and that you are typing full words. | halt }
if (%msg.type == private) { notice %pricenick 3[14RannServ3] %output }
elseif (%msg.type == public) { msg %pricechannel 3[14RannServ3] %output }
else { msg %pricechannel Error. Please eat a sock. }
write -dl 1 pricedownload.txt
write -dl 1 pricedownload.txt
}
}
else {
var %itemname $read(pricedownload.txt,1)
var %price $read(pricedownload.txt,2)
var %output $+ %c1 $+ %itemname $+ : $+ %c2 %price $+ %type $chr(124) $+ $+ %c3 $priceappend
if (spelling isin $read(pricedownload.txt,1)) { notice %pricenick $+(,%c2,Your) search did not return any results. Please make sure your spelling is correct and that you are typing full words. | halt }
if (%msg.type == private) { notice %pricenick 3[14RannServ3] %output }
elseif (%msg.type == public) { msg %pricechannel 3[14RannServ3] %output }
else { msg %pricechannel Error. Please eat a sock. }
}
remove pricedownload.txt
}
alias price sockopen $+(price,$r(1,9999999)) zybez.net 80
on *:sockopen:price*:{
sockwrite -n $sockname GET /priceguide.php?search_terms= $+ %rs.item $+ &search_area=1&price_low=&price_high=&member=1&w13=rules HTTP/1.1
sockwrite -n $sockname Host: www.zybez.net $+ $crlf $+ $crlf
}
on *:sockread:price*:{
if ($sockerr) {
echo -a Error.
halt
}
else {
sockread %temp
if (<!--name* iswm %temp) || (<!--price* iswm %temp) || (*spelling* iswm %temp) {
write pricedownload.txt $htmlfree($replace(%temp,& $+ $chr(59),&))
}
elseif (<!-- Search Results: End --> isin %temp) { pricemsg | sockclose $sockname }
}
}