menu channel { Stat:{ dialog -m stat stat } } dialog stat { title "XS RuneScape Stat Lookup" size -1 -1 300 350 text "Player:", 3, 100 10 50 50, right edit %defrsn, 4, 155 7 80 20, limit 12 button "Look Up", 5, 240 7 50 20 text "COMBAT", 11, 125 30 50 20, center text "Attack:", 12, 10 50 50 20, right text "Strength:", 13, 100 50 50 20, right text "Defence:", 14, 190 50 50 20, right text "Hitpoints:", 15, 10 70 50 20, right text "Magic:", 16, 100 70 50 20, right text "Ranged:", 17, 190 70 50 20, right text "Prayer:", 18, 10 90 50 20, right text "Combat:", 19, 100 90 50 20, right button "ReCalc", 20, 220 90 50 20 edit , 31, 70 48 25 20 edit , 32, 70 68 25 20 edit , 33, 70 88 25 20 edit , 34, 160 48 25 20 edit , 35, 160 68 25 20 edit , 36, 160 88 45 20 edit , 37, 250 48 25 20 edit , 38, 250 68 25 20 text "NONCOMBAT", 50, 115 120 70 20, center text "Mining:", 51, 10 140 50 50, right text "Smithing:", 52, 100 140 50 20, right text "Crafting:", 53, 190 140 50 20, right edit , 70, 70 138 25 20 edit , 71, 160 138 25 20 edit , 72, 250 138 25 20 text "Fishing:", 54, 10 180 50 20, right text "Cooking:", 55, 100 180 50 20, right text "Firemake:", 56, 190 180 50 20, right edit , 73, 70 178 25 20 edit , 74, 160 178 25 20 edit , 75, 250 178 25 20 text "Fletching:", 57, 10 220 50 20, right text "Woodcut:", 58, 100 220 50 20, right text "Runecrft:", 59, 190 220 50 20, right edit , 76, 70 218 25 20 edit , 77, 160 218 25 20 edit , 78, 250 218 25 20 text "Theiving:", 60, 10 260 50 20, right text "Agility:", 61, 100 260 50 20, right text "Herblore:", 62, 190 260 50 20, right edit , 79, 70 258 25 20 edit , 80, 160 258 25 20 edit , 81, 250 258 25 20 text "Slayer:", 63, 10 300 50 20, right text "Farming:", 64, 100 300 50 20, right text "Constr:", 65, 190 300 50 20, right edit , 82, 70 298 25 20 edit , 83, 160 298 25 20 edit , 84, 250 298 25 20 } dialog skill { Title %skill size -1 -1 250 310 text "User", 1, 55 1 50 20 edit , 10, 25 15 80 20, limit 12 button "Look Up", 20, 120 15 50 20 text "Level:", 2, 10 45 50 20, right edit , 11, 63 43 25 20 text "Next level:", 3, 8 80 70 20 edit , 12, 63 78 25 20 text "EXP:", 4, 100 45 50 20 edit , 13, 125 43 90 20 text "EXP:", 5, 100 80 50 20 edit , 14, 125 78 90 20 text "Rank", 8, 198 1 50 20 edit , 17, 175 15 70 20 text "EXP to next:", 7, 30 110 90 20, center edit , 16, 115 108 90 20 text "Items to Next Level", 6, 15 140 130 20 list 15, 10 155 230 150 } on *:DIALOG:stat:*:*:{ if ($devent == init) { if (%defrsn == $null) { set %defrsn $left($?="Default Runescape Username?",12) if (%defrsn == $null) { halt } else { .signal dstat %defrsn } } if (%defrsn != $null) { .signal dstat %defrsn } } if ($devent == sclick) { if ($did == 5) { .signal dstat $replace($did(4),$chr(32),+) } if ($did == 20) { did -o $dname 36 1 $cmbcalc($did(31),$did(37),$did(34),$did(32),$did(33)) } } if ($devent == dclick) { if ($inrect($mouse.x,$mouse.y,10,220,50,20)) { set %skill Fletching dialog -am skill skill | .signal dskill $did(stat,4) } } if ($devent == close) { sockclose dstat sockclose dskill } } on *:DIALOG:skill:*:*:{ if ($devent == init) { did -o skill 10 1 $did(stat,4) } if ($devent == sclick) { if ($did == 20) { .signal dskill $replace($did(skill,10),$chr(32),+) } } if ($devent == close) { sockclose dskill sockclose dstat unset %skill } } on *:SIGNAL:dstat:{ did -rb stat 31-38,70-84 set %lookup.d $replace($1-,$chr(32),+) sockopen dstat www.rscript.org 80 } on *:SIGNAL:dskill:{ set %lookup.d $replace($1-,$chr(32),+) sockopen dstat www.rscript.org 80 } on *:SOCKOPEN:dstat:{ sockwrite -nt $sockname GET /statpage.php?user= [ $+ [ %lookup.d ] ] HTTP/1.1 sockwrite -nt $sockname User-Agent: RuneScript Public (Crawler Bot; rscript.org;) sockwrite -nt $sockname Host: rscript.org $+ $crlf $+ $crlf if (%skill) { sockrename $sockname dskill } } on *:SOCKREAD:dstat:{ sockread -f %total tokenize 32 $remove(%total,Stat:) if (*does not feature* iswm $1-) { did -er stat 31-38,70-84 | sockclose $sockname } if (Attack == $1) { did -eo stat 31 1 $iif($3 isnum,$3,NA) } if (Hitpoints == $1) { did -eo stat 32 1 $iif($3 isnum,$3,NA) } if (Prayer == $1) { did -eo stat 33 1 $iif($3 isnum,$3,NA) } if (Strength == $1) { did -eo stat 34 1 $iif($3 isnum,$3,NA) } if (Defence == $1) { did -eo stat 37 1 $iif($3 isnum,$3,1) } if (Ranged == $1) { did -eo stat 38 1 $iif($3 isnum,$3,NA) } if (Magic == $1) { did -eo stat 35 1 $iif($3 isnum,$3,NA) did -eo stat 36 1 $cmbcalc($did(stat,31),$iif($did(stat,37) != NA,$did(stat,37),1),$did(stat,34),$did(stat,32),$did(stat,33)) } if (Herblore == $1) { did -eo stat 81 1 $iif($3 isnum,$3,NA) } if (Agility == $1) { did -eo stat 80 1 $iif($3 isnum,$3,NA) } if (Thieving == $1) { did -eo stat 79 1 $iif($3 isnum,$3,NA) } if (Crafting == $1) { did -eo stat 72 1 $iif($3 isnum,$3,NA) } if (Fletching == $1) { did -eo stat 76 1 $iif($3 isnum,$3,NA) } if (Slayer == $1) { did -eo stat 82 1 $iif($3 isnum,$3,NA) } if (Mining == $1) { did -eo stat 70 1 $iif($3 isnum,$3,NA) } if (Smithing == $1) { did -eo stat 71 1 $iif($3 isnum,$3,NA) } if (Fishing == $1) { did -eo stat 73 1 $iif($3 isnum,$3,NA) } if (Cooking == $1) { did -eo stat 74 1 $iif($3 isnum,$3,NA) } if (Runecraft == $1) { did -eo stat 78 1 $iif($3 isnum,$3,NA) } if (Firemaking == $1) { did -eo stat 75 1 $iif($3 isnum,$3,NA) } if (Woodcutting == $1) { did -eo stat 77 1 $iif($3 isnum,$3,NA) } if (Farming == $1) { did -eo stat 83 1 $iif($3 isnum,$3,NA) } if (Construction == $1) { did -eo stat 84 1 $iif($3 isnum,$3,NA) sockclose $sockname } } on *:SOCKREAD:dskill:{ sockread -f %total tokenize 32 $remove(%total,Stat:) if ($1 == %skill) { did -o skill 17 1 $2 did -o skill 11 1 $3 did -o skill 12 1 $iif($calc($3 + 1) isnum 1-99,$calc($3 + 1),NA) did -o skill 13 1 $4 did -o skill 14 1 $iif($calc($3 + 1) isnum 1-99,$bytes($nextlvl($3),b),NA) did -o skill 16 1 $iif($calc($3 + 1) isnum 1-99,$bytes($calc($nextlvl($3) - $remove($4,$chr(44))),b),0) sockclose dskill } } alias cmbcalc { return $calc((0.32707*$1)+(0.249*$2)+(0.324*$3)+(0.25*$4)+(0.124*$5)) } alias nextlvl { if ($1 !isnum 1-99) { return NA } else { var %nextlvl = $1 + 1 return $gettok($read(nextlvl.txt,%nextlvl),2,32) } }