All pastes #271783 Raw Edit

Stuff

public text v1 · immutable
·published 2006-12-08 13:24 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:sclick:12:{
  /set %removed $did(7)
  /did -r StatCalc 11
  /set %skillmatch 99
  :here 
  /set %lvlmatch $readini(StatCalc.ini,level,%skillmatch)
  if ($readini(StatCalc.ini,level,%skillmatch) > %removed) {
    /dec %Skillmatch
    /goto Here
  }
  else {
    if ($readini(StatCalc.ini,level,%skillmatch) <= %removed) {
      /did -a StatCalc 11 %skillmatch
      did -a Statcalc 68 $calc(%skillmatch + 1 )
      /set %lvlup $calc(%skillmatch + 1)
    }
  }
}
on *:dialog:Statcalc:init:0:{
  if ($readini(StatCalc.ini,SavedName,1)) { 
    did -a StatCalc 1 $readini(StatCalc.ini,SavedName,1)
  }
  /did -a Statcalc 13 Choose Skill
  /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
  /did -c StatCalc 13 Choose Skill
}
on *:dialog:Statcalc:sclick:8:{
  /writeini StatCalc.ini SavedName 1 $did(1)
  /dialog -m NickSaved NickSaved
  /did -a NickSaved 2 $readini(StatCalc.ini,SavedName,1)
}
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...
      /did -h StatCalc 19-42
      /did -r StatCalc 43-66
      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 -r Statcalc 68
        did -a StatCalc 68 $calc($gettok(%sockreader,2,32) +1)
        sockclose Stats
        /did -a Statcalc 3 Get Stats
        /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 321 245
  option dbu
  edit "", 1, 74 24 50 10
  text "Runescape Name", 2, 23 25 45 8, right
  button "Get Stats", 3, 130 23 37 12, default
  button "Close", 4, 106 217 37 12, ok
  button "Reset", 6, 171 217 37 12
  edit "", 7, 74 42 50 10
  text "Current Xp", 9, 36 43 32 8, right
  text "Current Level", 10, 33 61 35 8, right
  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 292 75
  box "Needed Items", 16, 20 92 292 122
  edit "", 17, 232 58 39 10, read
  text "Experience To Goal", 18, 182 59 47 8
  edit "", 19, 69 110 37 10, hide read
  edit "", 20, 69 122 37 10, hide read
  edit "", 21, 69 134 37 10, hide read
  edit "", 22, 69 146 37 10, hide read
  edit "", 24, 69 170 37 10, hide read
  edit "", 31, 169 158 37 10, hide read
  edit "", 32, 169 170 37 10, hide read
  edit "", 34, 169 194 37 10, hide read
  edit "", 35, 269 110 37 10, hide read
  edit "", 27, 169 110 37 10, hide read
  edit "", 33, 169 182 37 10, hide read
  edit "", 26, 69 194 37 10, hide read
  edit "", 28, 169 122 37 10, hide read
  edit "", 29, 169 134 37 10, hide read
  edit "", 30, 169 146 37 10, hide read
  edit "", 25, 69 182 37 10, hide read
  edit "", 23, 69 158 37 10, hide read
  edit "", 36, 269 122 37 10, hide read
  edit "", 37, 269 134 37 10, hide read
  edit "", 38, 269 146 37 10, hide read
  edit "", 39, 269 158 37 10, hide read
  edit "", 40, 269 170 37 10, hide read
  edit "", 42, 269 194 37 10, hide read
  edit "", 41, 269 182 37 10, hide read
  text "", 43, 25 111 40 8, center
  text "", 44, 25 123 40 8, center
  text "", 45, 25 135 40 8, center
  text "", 46, 25 147 40 8, center
  text "", 47, 25 159 40 8, center
  text "", 48, 25 171 40 8, center
  text "", 49, 25 183 40 8, center
  text "", 50, 25 195 40 8, center
  text "", 51, 125 111 40 8, center
  text "", 52, 125 123 40 8, center
  text "", 53, 125 135 40 8, center
  text "", 54, 125 147 40 8, center
  text "", 55, 125 159 40 8, center
  text "", 56, 125 171 40 8, center
  text "", 57, 125 183 40 8, center
  text "", 58, 125 195 40 8, center
  text "", 59, 225 111 40 8, center
  text "", 60, 225 123 40 8, center
  text "", 61, 225 135 40 8, center
  text "", 62, 225 147 40 8, center
  text "", 63, 225 159 40 8, center
  text "", 64, 225 171 40 8, center
  text "", 65, 225 183 40 8, center
  text "", 66, 225 195 40 8, center
  text "Goal Level", 67, 204 44 25 8
  edit "", 68, 233 43 14 10, limit 2
  text "Made by Steiner-99", 5, 132 234 59 8, disable
}
on *:dialog:StatCalc:sclick:69:{
  /calcitems
}
alias calcitems {
  /did -r Statcalc 68
  /did -a StatCalc 68 %lvlup
  /did -r Statcalc 43-66,17
  /did -r StatCalc 19-42
  /did -h StatCalc 19-42
  /set %lines $ini(StatCalc.ini,%skill,0)
  /set %linestoread 1
  /did -a StatCalc 17 $calc($readini(StatCalc.ini,level,%lvlup) - %removed)
  :here
  /did -a StatCalc $calc(%linestoread + 42) $gettok($readini(StatCalc.ini,%skill,%linestoread),1,92)
  /did -v StatCalc $calc(%linestoread + 18)
  /did -a StatCalc $calc(%linestoread + 18) $floor($calc( ($readini(StatCalc.ini,level,%lvlup) - %removed) / $gettok($readini(StatCalc.ini,%skill,%linestoread),2,92) +1))
  if (%linestoread != %lines) { 
    /inc %linestoread 
    goto Here
  }
  else { halt }
}
on *:dialog:StatCalc:edit:68:{
  /set %lvlup $did(68)
  /calcitems
}
dialog NickSaved {
  title "Name Saved"
  size -1 -1 108 49
  option dbu
  text "Default Name Set to ", 1, 27 9 53 9, center
  Text "", 2, 28 22 50 10, center
  button "Ok", 3, 36 34 37 12, ok
}