All pastes #267400 Raw Edit

Stuff

public text v1 · immutable
·published 2006-12-04 20:55 UTC
rendered paste body
menu * { 
  Stat Calculator:/dialog -m StatCalc StatCalc
}
alias /go {
  /dialog -m Statcalc StatCalc
}
on *:dialog:Statcalc:sclick:13:{
  /set %skill $did(13)
}
on *:dialog:Statcalc:init:0:{
  /did -a Statcalc 13 Agility 
  /did -a Statcalc 13 Attack
  /did -a Statcalc 13 Construction
  /did -a Statcalc 13 Cooking
  /did -a Statcalc 13 Crafting 
  /did -a Statcalc 13 Defence
  /did -a Statcalc 13 Farming
  /did -a Statcalc 13 Firemaking
  /did -a Statcalc 13 Fishing
  /did -a StatCalc 13 Fletching
  /did -a Statcalc 13 Herblore
  /did -a Statcalc 13 Hitpoints
  /did -a Statcalc 13 Hunter
  /did -a Statcalc 13 Magic
  /did -a Statcalc 13 Mining
  /did -a Statcalc 13 Prayer
  /did -a Statcalc 13 Ranged
  /did -a Statcalc 13 Runecraft
  /did -a Statcalc 13 Slayer
  /did -a Statcalc 13 Smithing
  /did -a Statcalc 13 Strength
  /did -a Statcalc 13 Thieving
  /did -a Statcalc 13 Woodcutting
}
on *:dialog:Statcalc:sclick:8:{
  /write StatCalc.txt Defaultname: $+ $did(1).text $+ 
}
on *:dialog:Statcalc:sclick:3:{
  if ($did(13) == $null) { did -a Statcalc 13 Choose Skill | did -c StatCalc 13 Choose Skill }
  else {
    if ($did(1) == $null) { did -a StatCalc 1 Enter RSName } 
    else {
      /did -a StatCalc 3 Please Wait...
      set %user $did(1).text 
      sockopen Stats o-ss.net 80
    }
  }
}
on *:SOCKOPEN:Stats: {
  sockwrite -nt $sockname GET /parsers/skills.php?user= [ $+ [ %user ] $+ ] &skill= [ $+ [ %skill ] ] HTTP/1.1
  sockwrite -nt $sockname Host: o-ss.net
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:Stats: {
  if ($sockerr) {
    msg %chan Socket Error: $sockname $+ . Error code: $sockerr Please inform $me of this error message.
    halt
  }
  else {
    var %sockreader
    sockread %sockreader
    if (*END* iswm %sockreader ) {
      if ($gettok(%sockreader,1,32) == END || $gettok(%sockreader,1,32) == $null) { 
        did -r StatCalc 7
        did -r StatCalc 11
        did -a StatCalc 7 Not In Hiscores 
        sockclose Stats
        /did -a Statcalc 3 Get Stats
        /unset %skill
        /unset %user
      }
      else {
        did -r StatCalc 7
        did -r StatCalc 11
        /set %removed $remove($gettok(%sockreader,3,32),$chr(44))
        did -a Statcalc 7 $gettok(%sockreader,3,32)
        did -a Statcalc 11 $gettok(%sockreader,2,32)
        /set %lvlup $calc($gettok(%sockreader,2,32) +1)
        did -a StatCalc 33 %levelup
        sockclose Stats
        /did -a Statcalc 3 Get Stats
        /unset %skill
        /unset %user
        /calcitems
      }
    }
  }
}
on *:dialog:StatCalc:sclick:6:{
  /did -r Statcalc 1,7,11,14
}
on *:dialog:StatCalc:sclick:16:{
  did -f StatCalc 13
}
dialog StatCalc {
  title "Steiner Stat Calculator"
  size -1 -1 250 219
  option dbu
  edit "", 1, 74 24 50 10
  text "Runescape Name", 2, 23 25 45 8
  button "Get Stats", 3, 130 23 37 12, default
  button "Close", 4, 54 201 37 12, ok
  button "Cancel", 5, 109 201 37 12
  button "Reset", 6, 164 201 37 12
  edit "", 7, 74 42 50 10
  text "Current Xp", 9, 36 43 32 8
  text "Current Level", 10, 29 61 39 8
  edit "", 11, 74 60 14 10, read
  button "Calc Level", 12, 130 41 37 12, default
  combo 13, 99 60 60 50, size limit 23 drop
  button "Set As Default Name", 8, 176 23 57 12
  text "-----", 14, 167 25 9 8, center
  box "Getting Your Lvl", 15, 20 15 217 60
  box "Needed Items", 16, 20 75 217 122
  text "Text Label", 17, 30 86 42 8
  text "Text Label", 18, 30 97 42 8
  text "Text Label", 19, 30 108 42 8
  text "Text Label", 20, 30 119 43 8
  text "Text Label", 21, 30 130 42 8
  text "Text Label", 22, 30 141 42 8
  text "Text Label", 23, 30 152 42 8
  edit "", 24, 75 85 27 10, read
  edit "", 25, 75 96 27 10
  edit "", 28, 75 129 27 10
  edit "", 29, 75 140 27 10
  edit "", 26, 75 107 27 10
  edit "", 27, 75 118 27 10
  edit "", 30, 75 151 27 10
  text "Text Label", 31, 30 162 42 8
  edit "", 32, 75 162 27 10
  edit "", 33, 214 60 14 10, read
  text "Next Level", 34, 182 61 27 8
}


alias calcitems {
  /set %lines $ini(fletching.ini,fletching,0)
  /set %linestoread 1
  :here
  /did -a StatCalc $calc(%linestoread + 16) $gettok($readini(Fletching.ini,fletching,%linestoread),1,92)
  /did -a StatCalc $calc(%linestoread + 23) $floor($calc( ($readini(fletching.ini,level,%lvlup) - %removed) / $gettok($readini(Fletching.ini,Fletching,%linestoread),2,92) +1))
  ;$calc($calc($readini(Flecthing.ini,Level, $calc($gettok(%sockreader,2,32) +1)) -  $gettok(%sockreader,3,32)) / $gettok($readini(Fletching.ini,Level,%linestoread),2,92)) 
  if (%linestoread != %lines) { 
    /inc %linestoread 
    goto Here
  }
  else { halt }
}