mIRC Home    About    Download    Register    News    Help

Print Thread
Script Help!! #187782 12/10/07 11:37 AM
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
Why Wont this work?
Quote:
on *:TEXT:!alch*:#: {
inc %s
set $+(%,return.,%s) $iif($left($1,1) == @, msg $chan, notice $nick)
if ($2- == $null) { %return. [ $+ [ %s ] ] add a item to lookup! use -p switch for p2p players -f switch for f2p players example: !item rune axe or !item -f rune axe!
halt
}
set $+(%,players.,%s) all
set $+(%,item.,%s) $replace($2-,$chr(32),+)
set $+(%,item2.,%s) $2-
sockopen $+(item.,%s) tip.it 80
}
on *:SOCKOPEN:item.*: {
var %s = $gettok($sockname,2,46)
sockwrite -nt $sockname GET /runescape/index.php?rs2item=&orderby=0&keywords= $+ %item. [ $+ [ %s ] ] $+ &Players=all&category=0&subcategory=0&cmd=8&action=Manage_Items&search=1&submit=Simple+Search HTTP/1.1
sockwrite -nt $sockname Host: tip.it
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:item.*: {
var %s = $gettok($sockname,2,46)
if ($sockerr) {
%return. [ $+ [ %s ] ] Socket error, please report this to $me $+ .
halt
}
var %read
sockread %read
if (*<p><strong>1</strong> items matched your search.</p>* iswm %read) {
/tokenize 32 $htmlfree(%read)
set %itemresults [ $+ [ %s ] ] $1
}
if (*<td><a href="index.php?rs2item_id* $+ %item2. [ $+ [ %s ] ] $+ *</a></td>* iswm %read) {
set %read2 [ $+ [ %s ] ] $remove($htmlfree(%read),$chr(9))
set %itemid [ $+ [ %s ] ] $remove(%read,<td><a href="index.php?rs2item_id=,</a></td>,$chr(34), $+ %read2 [ $+ [ %s ] ] $+ )
/tokenize 62 %itemid [ $+ [ %s ] ]
set %itemid [ $+ [ %s ] ] $remove($1,$chr(9))
sockopen $+(item2.,%s) tip.it 80
sockclose $sockname
}
}
on *:SOCKOPEN:item2.*: {
var %s = $gettok($sockname,2,46)
sockwrite -nt $sockname GET /runescape/index.php?rs2item_id= $+ %itemid [ $+ [ %s ] ] HTTP/1.1
sockwrite -nt $sockname Host: tip.it
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:item2.*: {
var %s = $gettok($sockname,2,46)
if ($sockerr) {
%return. [ $+ [ %s ] ] Socket error, please report this to $me $+ .
halt
}
var %aread
sockread %aread
if (*<b>Members?</b>* iswm %aread) {
/tokenize 32 $htmlfree(%aread)
set %memb [ $+ [ %s ] ] $remove($2,$chr(9))
}
if (*<b>Quest?</b>* iswm %aread) {
/tokenize 32 $htmlfree(%aread)
set %quest [ $+ [ %s ] ] $remove($2,$chr(9))
}
if (*<b>Tradeable?</b>* iswm %aread) {
/tokenize 32 $htmlfree(%aread)
set %trade [ $+ [ %s ] ] $remove($2,$chr(9))
}
if (*category* iswm %aread) {
var %catg
sockread %catg
}
if (*<td width="25%"> iswm %catg) {
var %alch
sockread %alch
set %catg [ $+ [ %s ] ] $remove(%alch,$chr(09))
}
if (*High Alchemy</td> iswm %aread) {
var %alchemy
sockread %alchemy
}
if (*<td width="25%"> iswm %alchemy) {
var %alch
sockread %alch
set %highalch [ $+ [ %s ] ] $remove(%alch,$chr(09))
}
if (*gp iswm %aread) {
set %itemprice [ $+ [ %s ] ] $remove(%aread,$chr(9))
}
if (*Location</td> iswm %aread) {
var %place
sockread %place
}
if (*<td> iswm %place) {
var %lol
sockread %lol
set %itemplace [ $+ [ %s ] ] $remove($htmlfree(%lol),$chr(09))
}
if (*<td class="header"> Uses</td>* iswm %aread) {
var %use
sockread %use
}
if (*<td> iswm %use) {
var %lol2
sockread %lol2
set %itemuse [ $+ [ %s ] ] $remove($htmlfree(%lol2),$chr(9))
}
if (*Notes</td>* iswm %aread) {
var %note
sockread %note
}
if (*<td> iswm %note) {
var %lol3
sockread %lol3
set %itemnote [ $+ [ %s ] ] $remove($htmlfree(%lol3),$chr(9))
%return. [ $+ [ %s ] ] $c1(Result:) $c2 $+ %read2 [ $+ [ %s ] ] $c1(Members:) $c2 $+ %memb [ $+ [ %s ] ] $c1(Quest:) $c2 $+ %quest [ $+ [ %s ] ] $c1(Tradeable:) $c2 $+ %trade [ $+ [ %s ] ]
%return. [ $+ [ %s ] ] $c1(Low Alch:) $c2 $+ %itemprice [ $+ [ %s ] ] $c1(Alch price:) $c2 $+ %highalch [ $+ [ %s ] ] $c1(Item use:) $c2 $+ %itemuse [ $+ [ %s ] ]
%return. [ $+ [ %s ] ] $c1(Location:) $c2 $+ %itemplace [ $+ [ %s ] ]
%return. [ $+ [ %s ] ] $c1(Notes:) $c2 $+ %itemnote [ $+ [ %s ] ]
%return. [ $+ [ %s ] ] $c3(www.tip.it/runescape/index.php?rs2item_id= $+ %itemid [ $+ [ %s ] ] )
sockclose $sockname
/unsetvars
}
}
alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) | return %x
}
alias -l c1 return $+($chr(3),12,$1-,)
alias -l c2 return $+($chr(3),07,$1-,)
alias -l c3 return $+($chr(3),07,,$1-,)

alias unsetvars {
/unset %return. [ $+ [ %s ] ]
/unset %item. [ $+ [ %s ] ]
/unset %item2. [ $+ [ %s ] ]
/unset %read2 [ $+ [ %s ] ]
/unset %itemid [ $+ [ %s ] ]
/unset %memb [ $+ [ %s ] ]
/unset %quest [ $+ [ %s ] ]
/unset %trade [ $+ [ %s ] ]
/unset %highalch [ $+ [ %s ] ]
/unset %itemprice [ $+ [ %s ] ]
/unset %itemplace [ $+ [ %s ] ]
/unset %itemuse [ $+ [ %s ] ]
/unset %itemnote [ $+ [ %s ] ]
}


It wont rune or give me an error message or anything.

Last edited by zad0909; 12/10/07 11:38 AM.
Re: Script Help!! [Re: zad0909] #187813 13/10/07 05:12 AM
Joined: Aug 2004
Posts: 5
V
Vulcan Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
V
Joined: Aug 2004
Posts: 5
how about giving this a try?

Code:
alias fix { return $regsubex($1,/\b(.)/g,$upper(\1)) }
on $*:TEXT:/^[.!@]alch .*$/Si:*:{
  if ($2 == $null) { .notice $nick Please Specify a name/item to lookup. | halt }
  var %alch.id $r(10000,99999)
  sockopen $+(alch.,%alch.id) astralscript.org 80
  sockmark $+(alch.,%alch.id) $iif($chan == $null,$nick,$chan) $nick $+($chr(3),14) $+($chr(3),10) $iif($query($nick),pm,$iif($hget(chandb,$+($network,:,$chan,:all)) == private,pr,$iif($left($1,1) == @,pu,pr))) $replace($2-,$chr(32),+)
}
on *:SockOpen:alch.*:{
  sockwrite -nt $sockname GET /bot/geniealch.php?name= $+ $6 HTTP/1.0
  sockwrite -nt $sockname Host: astralscript.org $+ $str($crlf,2)
}
on *:SockRead:alch.*:{
  var %read | .sockread %read | tokenize 124 $remove(%read,Genie:)
  var %c1 $gettok($sock($sockname).mark,3,32), %c2 $gettok($sock($sockname).mark,4,32), %send $replace($gettok($sock($sockname).mark,5,32),pm,.msg $gettok($sock($sockname).mark,2,32),pu,.msg $gettok($sock($sockname).mark,1,32),pr,.notice $gettok($sock($sockname).mark,2,32))
  if ($0 == 3) { %send $+(%c1,Item:,%c2) $fix($1) $+(%c1,Low Alch:,%c2) $3 $+(%c1,High Alch:,%c2) $2 | unset $+(%,$sockname,.,*) }
  if ($0 == 4) { %send No Items Found | unset $+(%,$sockname,.,*) }
}