All pastes #272260 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-08 21:37 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)
      /calcitems
    }
  }
}
on *:dialog:Statcalc:init:0:{
  if ($readini(StatCalc.ini,SavedName,1)) { 
    did -a StatCalc 1 $readini(StatCalc.ini,SavedName,1)
  }
  /set %dialog StatCalc 13
  /addskills
}
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) == Choose Skill) { dialog -m NoSkill NoSkill | beep 1 0 }
  else {
    if ($did(1) == $null) { dialog -m NoNick NoNick | beep 1 0 } 
    else {
      /did -a StatCalc 3 Please Wait...
      /did -h StatCalc 19-42
      /did -r StatCalc 43-66,7,11,17,68
      set %user $replace($did(1),$chr(32),$chr(45))
      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 7,11,68,17,43-66
  /did -c StatCalc 13 1
  /did -h StatCalc 19-42
}
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, 199 218 37 12, ok
  button "Reset", 6, 110 218 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 63
  box "Needed Items", 16, 20 81 292 133
  edit "", 17, 232 60 39 10, read
  text "Experience To Goal", 18, 182 61 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, 130 234 86 8, disable center
  button "Add Item(s)", 69, 268 34 41 12
  button "Delete Item(s)", 71, 268 21 41 12
}
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 %linestoread 1
  /did -a StatCalc 17 $calc($readini(StatCalc.ini,level,%lvlup) - %removed)
  while ($ini(statcalc.ini,%skill,%linestoread)) { 
    /did -a StatCalc $calc(%linestoread + 42) $replace($v1,$chr(95),$chr(32))
    /did -v StatCalc $calc(%linestoread + 18)
    /did -a StatCalc $calc(%linestoread + 18) $floor($calc(($readini(StatCalc.ini,level,%lvlup) - %removed) / $readini(StatCalc.ini,%skill,$v1) +1))
    /inc %linestoread
  }
}
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
}
dialog NoNick {
  title "No Name Entered"
  size -1 -1 119 46
  option dbu
  text "!!! ERROR !!!", 1, 0 3 119 8, center
  text ">>>No Username Entered<<<", 2, -1 12 118 8, center
  text "Please enter one before continuing", 3, 0 25 119 14, center
  button "Ok", 4, 49 36 19 8, ok
}
dialog NoSkill {
  title "No Skill Selected"
  size -1 -1 119 46
  option dbu
  text "!!! ERROR !!!", 1, 0 3 119 8, center
  text ">>>No Skill Selected<<<", 2, -1 12 118 8, center
  text "Please select one before continuing", 3, 0 25 119 14, center
  button "Ok", 4, 49 36 19 8, ok
}
on *:dialog:StatCalc:sclick:69:{
  /dialog -m Additem Additem
}
on *:dialog:Additem:init:0:{
  /set %dialog AddItem 1
  /addskills
}
on *:dialog:Additem:sclick:1:{
  if ($regex($did(1),/(Attack|Strength|Defence|Hitpoints|Ranged)/Si)) {
    /did -a Additem 5 Monsters Hp
  }
  else { /did -a Additem 5 Exp Given }
}
on *:dialog:Additem:sclick:7:{
  if ($did(1) == Choose Skill) { /dialog -m Noskill NoSkill | halt }
  if ($regex($did(1),/(Attack|Strength|Defence|Ranged)/Si)) {
    /writeini StatCalc.ini $did(1) $replace($did(4),$chr(32),$chr(95)) $calc($did(6) * 4)
  }
  elseif ($did(1) == Hitpoints) {
    /writeini StatCalc.ini $did(1) $replace($did(4),$chr(32),$chr(95)) $calc($did(6) * 1.333)
  }
  else {
    /writeini StatCalc.ini $did(1) $replace($did(4),$chr(32),$chr(95)) $did(6)
  }
  /set %item $did(4)
  /set %where $did(1)
  /dialog -m Itemadded Itemadded
}
dialog Additem {
  title "Adding An Item"
  size -1 -1 183 69
  option dbu
  combo 1, 70 7 60 50, size drop
  text "Select Skill", 2, 19 8 48 8
  text "Item To Be Added", 3, 19 24 46 8
  edit "", 4, 70 23 50 10
  text "Exp Given", 5, 19 40 46 8
  edit "", 6, 70 39 50 10
  button "Add Item", 7, 49 56 37 12
  button "Cancel", 8, 105 56 37 12, ok cancel
}
on *:dialog:StatCalc:sclick:71:{
  /dialog -m Delitem Delitem
}
on *:dialog:Delitem:init:0:{
  /set %dialog Delitem 2
  /addskills
  /did -ac Delitem 4 Select Skill
}
on *:dialog:Delitem:sclick:2:{
  /did -r Delitem 4
  /var %linestoread = 1
  /set %whatitems $did(2)
  while ($ini(statcalc.ini,%whatitems,%linestoread)) { 
    /did -a Delitem 4 $replace($v1,$chr(95),$chr(32))
    /inc %linestoread
  }
}
on *:dialog:delitem:sclick:5:{
  /remini Statcalc.ini $did(2) $replace($did(4),$chr(32),$chr(95))
  /set %item $did(4)
  /set %where $did(2)
  /dialog -m Itemdeleted Itemdeleted
}
dialog DelItem {
  title "Removing An Item"
  size -1 -1 183 69
  option dbu
  icon C:\Documents and Settings\Jolie\Mijn documenten\Mijn afbeeldingen\Hehe.bmp, 0
  text "Select Skill", 1, 19 12 48 8
  combo 2, 76 11 60 50, size drop
  text "Select Item", 3, 19 28 48 8
  combo 4, 76 27 60 50, size drop
  button "Delete Item", 5, 45 52 37 12
  button "Cancel", 6, 100 52 37 12, ok cancel
}
alias /addskills {
  /did -a %dialog Choose Skill
  /did -a %dialog Agility 
  /did -a %dialog Attack
  /did -a %dialog Construction
  /did -a %dialog Cooking
  /did -a %dialog Crafting 
  /did -a %dialog Defence
  /did -a %dialog Farming
  /did -a %dialog Firemaking
  /did -a %dialog Fishing
  /did -a %dialog Fletching
  /did -a %dialog Herblore
  /did -a %dialog Hitpoints
  /did -a %dialog Hunter
  /did -a %dialog Magic
  /did -a %dialog Mining
  /did -a %dialog Prayer
  /did -a %dialog Ranged
  /did -a %dialog Runecraft
  /did -a %dialog Smithing
  /did -a %dialog Strength
  /did -a %dialog Thieving
  /did -a %dialog Woodcutting
  /did -c %dialog 1
  /unset %dialog
}
on *:dialog:Itemadded:init:0:{
  /did -a Itemadded 2 %item added to %where
}
on *:dialog:itemadded:sclick:3:{
  /dialog -x Itemadded
  /dialog -x Additem
  /unset %item
  unset %where
}
dialog Itemadded {
  title "Item Added"
  size -1 -1 116 48
  option dbu
  text "~~~Item succesfully added~~~", 1, 1 5 114 12, center
  text "", 2, 1 23 115 8, center
  button "Ok", 3, 40 36 30 8
}
on *:dialog:Itemdeleted:init:0:{
  /did -a Itemdeleted 2 %item deleted from %where
}
on *:dialog:Itemdeleted:sclick:3:{
  /dialog -x Itemdeleted
  /dialog -x Delitem
  /unset %item
  unset %where
}
dialog Itemdeleted {
  title "Item Deleted"
  size -1 -1 116 48
  option dbu
  text "~~~Item succesfully deleted~~~", 1, 1 5 114 12, center
  text "", 2, 1 23 115 8, center
  button "Ok", 3, 40 36 30 8
}