RuneScape Stats Script [BETA]

By Trev on Jul 04, 2009

A simply and ugly coded RuneScape stats script.

I have no idea if it works and I hardly care at all, this is a very old post.

Commands:

[!.@]Stats

Enjoy, I won't be fixing this.

;;Start of color Alias (Need this for the script to work!!)
Alias cc1 return $+($chr(3),01,$1-)
Alias cc2 return $+($chr(3),02,$1-)
Alias lg return $+($cc1($chr(40)),$cc2($1 $+ $chr(153)),$cc1($chr(41))))
;;Start of the Stats script.
On $*:TEXT:/^[!.@]stats/Si:#: {
  if ($2) { set %rsn.nick $replace($2-,$chr(32),$chr(95)) }
  elseif ($readini(Defnames.ini,DefRSN,$address($nick,3))) { set %rsn.nick $ifmatch }
  Else { set %rsn.nick $nick }
  set %rsn.style $iif($mid($1,1,1) == $chr(64),msg #,.notice $nick)
  sockopen Stats. www.rscript.org 80
}
On *:SOCKOPEN:Stats.: {
  sockwrite -n $sockname GET /lookup.php?type=stats&user= $+ %rsn.nick HTTP/1.1
  sockwrite -n $sockname Host: www.rscript.org
  sockwrite -n $sockname $crlf
}
On *:SOCKREAD:Stats.: {
  if ($Sockerr) { halt }
  Else {
    var %stats
    sockread %stats
    if (*STAT: not found* iswm %stats) { %rsn.style $lg(Error) $cc1($chr(40)) $cc2(%rsn.nick) $cc1($chr(41)) $cc2(was not found in the RuneScape Hiscores.) | unset %rsn.* | sockclose $sockname }
    if (*STAT:Overall* iswm %stats) { tokenize 32 %stats | set %rsn.overall $cc2(Overall:) $cc1($3) }
    if (*STAT:Attack* iswm %stats) { tokenize 32 %stats | set %rsn.attack $cc2(Attack:) $cc1($3) }
    if (*STAT:Defence* iswm %stats) { tokenize 32 %stats | set %rsn.defence $cc2(Defence:) $cc1($3) }
    if (*STAT:Strength* iswm %stats) { tokenize 32 %stats | set %rsn.Strength $cc2(Strength:) $cc1($3) }
    if (*STAT:Hitpoints* iswm %stats) { tokenize 32 %stats | set %rsn.hp $cc2(HP:) $cc1($3) }
    if (*STAT:Ranged* iswm %stats) { tokenize 32 %stats | set %rsn.ranged $cc2(Range:) $cc1($3) }
    if (*STAT:Prayer* iswm %stats) { tokenize 32 %stats | set %rsn.prayer $cc2(Pray:) $cc1($3) }
    if (*STAT:Magic* iswm %stats) { tokenize 32 %stats | set %rsn.magic $cc2(Mage:) $cc1($3) }
    if (*STAT:Cooking* iswm %stats) { tokenize 32 %stats | set %rsn.cooking $cc2(Cook:) $cc1($3) }
    if (*STAT:Woodcutting* iswm %stats) { tokenize 32 %stats | set %rsn.wc $cc2(Woodcutt:) $cc1($3) }
    if (*STAT:Fletching* iswm %stats) { tokenize 32 %stats | set %rsn.fletch $cc2(Fletch:) $cc1($3) }
    if (*STAT:Fishing* iswm %stats) { tokenize 32 %stats | set %rsn.fish $cc2(Fishing:) $cc1($3) }
    if (*STAT:Firemaking* iswm %stats) { tokenize 32 %stats | set %rsn.fm $cc2(Firemake:) $cc1($3) }
    if (*STAT:Crafting* iswm %stats) { tokenize 32 %stats | set %rsn.craft $cc2(Craft:) $cc1($3) }
    if (*STAT:Smithing* iswm %stats) { tokenize 32 %stats | set %rsn.smith $cc2(Smithing:) $cc1($3) }
    if (*STAT:Mining* iswm %stats) { tokenize 32 %stats | set %rsn.mine $cc2(Mining:) $cc1($3) }
    if (*STAT:Herblore* iswm %stats) { tokenize 32 %stats | set %rsn.herb $cc2(Herblore:) $cc1($3) }
    if (*STAT:Agility* iswm %stats) { tokenize 32 %stats | set %rsn.agil $cc2(Agility:) $cc1($3) }
    if (*STAT:Thieving* iswm %stats) { tokenize 32 %stats | set %rsn.thief $cc2(Thieving:) $cc1($3) }
    if (*STAT:Slayer* iswm %stats) { tokenize 32 %stats | set %rsn.slay $cc2(Slayer:) $cc1($3) }
    if (*STAT:Farming* iswm %stats) { tokenize 32 %stats | set %rsn.farm $cc2(Farming:) $cc1($3) }
    if (*STAT:Hunter* iswm %stats) { tokenize 32 %stats | set %rsn.hunt $cc2(Hunter:) $cc1($3) }
    if (*STAT:Construction* iswm %stats) { tokenize 32 %stats | set %rsn.con $cc2(Con:) $cc1($3) }
    if (*STAT:Summoning* iswm %stats) { tokenize 32 %stats | set %rsn.sum $cc2(Summoning:) $cc1($3) }
    if (*STAT:Runecraft* iswm %stats) { tokenize 32 %stats | set %rsn.rc $cc2(Runecraft:) $cc1($3) }
    if (*STAT:Dueling* iswm %stats) { tokenize 32 %stats | set %rsn.duel $cc2(Duel:) $cc1($3) }
    Elseif (%rsn.duel == $null) { set %rsn.duel $cc2(Duel:) $cc1(N/R) }
    if (*STAT:FOG* iswm %stats) { tokenize 32 %stats | set %rsn.fog $cc2(FOG:) $cc1($3) }
    Elseif (%rsn.fog == $null) { set %rsn.fog $cc2(FOG:) $cc1(N/R) }
    if (*DEBUG:* iswm %stats) {  
      %rsn.style $lg(%rsn.nick) %rsn.overall %rsn.attack %rsn.defence %rsn.strength %rsn.hp %rsn.range %rsn.magic %rsn.prayer %rsn.cooking %rsn.fletch %rsn.wc %rsn.fish %rsn.fm %rsn.craft %rsn.smith %rsn.mine %rsn.herb %rsn.agil %rsn.thief %rsn.farm %rsn.slay %rsn.rc %rsn.hunt %rsn.sum
      %rsn.style $lg(%rsn.nick) %rsn.fog %rsn.duel
      unset %rsn.*
      sockclose $sockname
    }
  }
}

Comments

Sign in to comment.
WorldDMT   -  Jul 07, 2009

hash table is like ini file

e.g

add data in:
ini file: /writeini file.ini NAME ITEM DATA
Hash tables: /hadd -m NAME ITEM DATA

read or get data

ini file: $readini(file.ini,NAME,ITEM) return DATA
Hash tables: $hget(NAME,ITEM) return DATA

take look at /help $hget

u have many parameter for $hget

$hget(NAME,0).item return the total number of item for NAME

$hget(NAME,1).item return the first item
$hget(NAME,1).data return the first data

e.g: NAME = Trev ; ITEM = testitem ; DATA = data test ok
1 2 3-
NAME ITEM DATA
/hadd -m Trev testitem data test ok

now u can try this

//echo -a $hget(trev,testitem) => return "data test ok"
//echo -a $hget(trev,1).data => return "data test ok"
//echo -a $hget(trev,1).item => return "testitem"
//echo -a $hget(trev,0).item => return "1"

now take look at /help $hget u'll find more about it :)

 Respond  
Trev   -  Jul 06, 2009

I don't know how to use hash tables; copying your script would teach me nothing.
Thanks though.

 Respond  
WorldDMT   -  Jul 06, 2009

hi

u can use "sockmark" instead "set" then use var for $2/$nick

for sockread u can use a regex and hash tables also that an idea to better explain my comment

on $*:TEXT:/^[!.@]stats/Si:#:{
  if ($2) var %rsn.nick $replace($2-,$chr(32),$chr(95))
  elseif ($readini(Defnames.ini,DefRSN,$address($nick,3))) var %rsn.nick $v1
  Else var %rsn.nick $nick
  sockopen Stats. www.rscript.org 80
  sockmark Stats. $iif($mid($1,1,1) == $chr(64),msg #,.notice $nick) |www.rscript.org| %rsn.nick
}
on *:SOCKOPEN:Stats.:{
  tokenize 124 $sock($sockname).mark
  sockwrite -n $sockname GET /lookup.php?type=stats&user= $+ $3 HTTP/1.1
  sockwrite -n $sockname Host: $2
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:Stats.:{
  if ($sockerr) { halt }
  Else {
    tokenize 124 $sock($sockname).mark
    var %stats | sockread %stats
    if (%stats == STAT: not found) { $1 $lg(Error) $cc1($chr(40)) $cc2($2) $cc1($chr(41)) $cc2(was not found in the RuneScape Hiscores.) | sockclose $sockname }
    elseif $regex($1-,/STAT\:(Overall|Attack|Defence|Strength|Hitpoints|Ranged|Prayer|Magic|Cooking|Woodcutting|Fletching|Fishing|Firemaking|Crafting|Smithing|Mining|Herblore|Agility|Thieving|Slayer|Farming|Hunter|Construction|Summoning|Runecraft)\s\w+\s(\d+)/i) {
      hadd -m stats.x $regml(1) $cc2($regml(1) $+ :) $cc1($regml(2))
    }
    elseif $regex($1-,/STAT:(Dueling|FOG)\s\w+(\s(\d+))?/i) {
      hadd -m stats.y $regml(1) $cc2($regml(1) $+ :) $cc1($iif($regml(3),$v1,N/R))
    }
    elseif (*DEBUG:* iswm %stats) {
      $1 $lg($3) $regsubex($str(.,$hget(stats.x,0).data),/./g,$hget(stats.x,\n).data $+ $chr(32))
      $1 $lg($3) $regsubex($str(.,$hget(stats.y,0).data),/./g,$hget(stats.y,\n).data $+ $chr(32))
      sockclose $sockname
    }
  }
}
on *:sockclose:Stats.:hfree -w stats.*
 Respond  
Aucun50   -  Jul 05, 2009

By your intro it looks good i'll have to give it a try.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.