dialog ExpCount { title "Average Exp" size -1 -1 183 156 option dbu box "User and Skill", 1, 1 2 181 51 text "User:", 2, 5 10 40 8, center edit "", 3, 59 9 88 10, center text "Skill:", 4, 5 24 42 8, center edit "", 5, 59 23 88 10, center button "Start", 6, 49 40 72 9 text "Starting Exp:", 8, 5 62 37 8, center edit "", 9, 69 61 45 10, read center text "Ending Exp:", 11, 5 85 40 8, center edit "", 12, 69 84 45 10, read center box "Exp. Made", 13, 1 96 181 58 box "Starting/Ending Exp.", 7, 1 53 181 101 button "Stop", 10, 118 59 61 37 text "Per 5 mins:", 14, 5 105 35 8, center text "Per 15 mins:", 15, 99 105 35 8, center edit "", 16, 135 104 45 10, read center edit "", 17, 48 104 46 10, read center text "Per 30 mins:", 18, 5 120 35 8, center edit "", 19, 48 119 46 10, read center text "By hours:", 20, 99 119 35 8, center edit "", 21, 135 118 45 10, read center edit "", 22, 6 136 172 10, read center } on *:DIALOG:ExpCount:sclick:6:{ if (!$did(3)) { dialog -m NoUser NoUser } else { if (!$did(5)) { dialog -m NoSkill NoSKill } else { set %StartExp on set %Time $ctime var %s = $ticks set %Skill $skill($did(5)) set %User $did(3) sockopen ExpStart. $+ %s nou.stirk.org 80 } } } on *:SOCKOPEN:ExpStart.*:{ sockwrite -n $sockname GET $+(/parsers/skill.php?user=,%User,&skill=,%Skill) HTTP/1.1 sockwrite -n $sockname Host: nou.stirk.org sockwrite -n $sockname $crlf } on *:SOCKREAD:ExpStart.*:{ if ($sockerr) { dialog -m SockErr SockErr halt } else { var %S sockread %S if (*Exp:* iswm %S) { did -ra ExpCount 9 $remove($gettok(%S,2,124),Exp:) set %Start $remove($gettok(%S,2,124),Exp:,$chr(44)) set %LevelStart $remove($gettok(%S,1,124),Level:) sockclose $sockname } } } on *:DIALOG:ExpCount:sclick:10:{ if (%StartExp != on) { dialog -m StartOff StartOff halt } else { unset %StartExp var %s = $ticks sockopen ExpEnd. $+ %s nou.stirk.org 80 } } on *:SOCKOPEN:ExpEnd.*:{ sockwrite -n $sockname GET $+(/parsers/skill.php?user=,%User,&skill=,%Skill) HTTP/1.1 sockwrite -n $sockname Host: nou.stirk.org sockwrite -n $sockname $crlf } on *:SOCKREAD:ExpEnd.*:{ if ($sockerr) { dialog -m SockErr SockErr halt } else { var %E sockread %E if (*Exp:* iswm %E) { set %LevelEnd $remove($gettok(%E,1,124),Level:) did -ra ExpCount 12 $remove($gettok(%E,2,124),Exp:) set %End $remove($gettok(%E,2,124),Exp:,$chr(44)) did -ra ExpCount 21 $bytes($round($calc((3600/($ctime - %Time))*(%End - %Start)),0),db) did -ra ExpCount 16 $bytes($round($calc((900/($ctime - %Time))*(%End - %Start)),0),db) did -ra ExpCount 17 $bytes($round($calc((300/($ctime - %Time))*(%End - %Start)),0),db) did -ra ExpCount 19 $bytes($round($calc((1800/($ctime - %Time))*(%End - %Start)),0),db) did -ra ExpCount 22 You've gained $iif(%LevelStart != %LevelEnd,$calc(%LevelEnd - %LevelStart) $iif($calc(%LevelEnd - %LevelStart) = 1,level,levels) $+($chr(40),$bytes($calc(%End - %Start),db),$chr(41)) in $duration($calc($ctime - %time)) $+ .,$bytes($calc(%End - %Start),db) xp in $duration($calc($ctime - %Time)) $+ .) } } } on *:SOCKCLOSE:ExpEnd.*:{ unset %End %Skill %User %End %Time %Start %LevelStart %LevelEnd } dialog NoSkill { title "Error - No Skill" size -1 -1 67 47 option dbu text "- Error -", 1, 21 6 19 8, center box "", 2, 1 -1 65 46 text "No Skill Specified.", 3, 5 20 54 8, center button "Cancel", 4, 13 32 37 8, cancel } dialog NoUser { title "Error - No Username" size -1 -1 67 47 option dbu text "- Error -", 1, 21 6 19 8, center box "", 2, 1 -1 65 46 text "No User Specified.", 3, 5 20 54 8, center button "Cancel", 4, 13 32 37 8, cancel } dialog SockErr { title "Socket Error" size -1 -1 67 47 option dbu text "- Error -", 1, 19 8 27 8, center text "Socket error, try again", 2, 3 19 60 8, center button "Cancel", 3, 15 33 37 10, cancel } dialog StartOff { title "Start" size -1 -1 67 47 option dbu text "- Error -", 1, 19 8 27 8, center text "You haven't started one yet.", 2, 3 19 60 14, center button "Cancel", 3, 15 34 37 10, cancel } alias skill { if ($did(5) == overall || $1 == total) { return Overall } if ($did(5) == attack || $1 == att || $1 == attk) { return Attack } if ($did(5) == def || $1 == defence) { return Defence } if ($did(5) == str || $1 == strength) { return Strength } if ($did(5) == hp || $1 == hitpoints || $1 == hits) { return Hitpoints } if ($did(5) == range || $1 == ranged || $1 == ranging) { return Ranged } if ($did(5) == pray || $1 == prayer || $1 == praying) { return Prayer } if ($did(5) == mage || $1 == magic) { return Magic } if ($did(5) == cook || $1 == cooking) { return Cooking } if ($did(5) == wc || $1 == wcing || $1 == woodcut || $1 == woodcutting) { return Woodcutting } if ($did(5) == fletch || $1 == fletching) { return Fletching } if ($did(5) == fishing || $1 == fish) { return Fishing } if ($did(5) == fm || $1 == firemaking) { return Firemaking } if ($did(5) == craft || $1 == crafting) { return Crafting } if ($did(5) == smith || $1 == smithing) { return Smithing } if ($did(5) == mining) { return Mining } if ($did(5) == herb || $1 == herblore) { return Herblore } if ($did(5) == agility || $1 == agil || $1 == agi) { return Agility } if ($did(5) == thiev || $1 == thieving) { return Thieving } if ($did(5) == slay || $1 == slaying || $1 == slayer) { return Slayer } if ($did(5) == farm || $1 == farming) { return Farming } if ($did(5) == rc || $1 == runecraft || $1 == runecrafting) { return Runecraft } if ($did(5) == construct || $1 == con || $1 == cons || $1 == construction) { return Construction } if ($did(5) == hunt || $1 == hunter || $1 == hunting) { return Hunter } if ($did(5) == summ || $1 == sum || $1 == summo || $1 == summon || $1 == summoning) { return Summoning } }