All pastes #122389 Raw Edit

Something

public text v1 · immutable
·published 2006-08-08 17:16 UTC
rendered paste body
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
menu channel {
  Friends List:{ 
    dialog -m nick nick
  }
}
menu NickList {
  Add { 
    set %friend $1
    write friends.txt $1
    notify $1
    //echo -a You Have Added $1 To Your Friends List.
    if (%dialog.nick == on) {
      did -a nick 4 %friend
      while (%1 < $did(nick,4).lines) {
        inc %1 1
        if ($gettok($did(nick,4,%1),1,32) isin %friend) {
          did -o nick 4 %1 $gettok($did(nick,4,%1),1,32) $iif($notify($did(nick,4,%1)).ison == $true,online,offline)  
        }
      }
    }
  }
}
on *:dialog:stats:sclick:99:{
  set %lookup.d $did(stats,30)
  set %lookup.d $replace(%lookup.d,$chr(32),+)
  did -rb stats 31-54
  sockopen dstat www.rscript.org 80
}
alias RSHS dialog -m stats stats
dialog stats {
  title "RS HIGH SCORE LOOK-UP"
  size -1 -1 200 200
  option dbu
  text "Combat:", 1, 82 10 20 10, left
  text "Overall:" 2, 133 10 25 10, left 
  text "Nickname:", 3, 5 10 25 10, left
  edit "", 30, 31 10 50 10, left
  edit "", 31, 104 10 28 10, left
  edit "", 32, 152 10 28 10, left
  button "Look UP!", 99, 31 20 25 10, left
  text "Attack:", 4, 5 35 25 10, left
  edit "", 33, 30 35 10 10, left
  text "Strength:", 5, 5 50 25 10, left
  edit "", 34, 30 50 10 10, left
  text "Defence:", 6, 5 65 25 10, left
  edit "", 35, 30 65 10 10, left
  text "Magic:", 7, 5 80 25 10, left
  edit "", 36, 30 80 10 10, left
  text "Range:", 8, 5 95 25 10, left
  edit "", 37, 30 95 10 10, left
  text "HitPoints:", 9, 5 110 25 10, left
  edit "", 38, 30 110 10 10, left
  text "Prayer:", 10, 5 125 25 10, left
  edit "", 39, 30 125 10 10, left
  text "Agility:", 11, 5 140 25 10, left
  edit "", 40, 30 140 10 10, left
  text "Herblore:", 12, 5 155 25 10, left
  edit "", 41, 30 155 10 10, left
  text "thieving:", 13, 5 170 25 10, left
  edit "", 42, 30 170 10 10, left
  text "runecraft:", 14, 5 185 25 10, left
  edit "", 43, 30 185 10 10, left
  text "Crafting:", 15, 105 35 25 10, left 
  edit "", 44, 130 35 10 10, left 
  text "Fletching:", 16, 105 50 25 10, left 
  edit "", 45, 130 50 10 10, left
  text "Mining:", 17, 105 65 25 10, left 
  edit "", 46, 130 65 10 10, left
  text "fishing:", 18, 105 80 25 10, left
  edit "", 47, 130 80 10 10, left
  text "Cooking:", 19, 105 95 25 10, left
  edit "", 48, 130 95 10 10, left
  text "Firemking:", 20, 105 110 25 10, left
  edit "", 49, 130 110 10 10, left
  text "Woodcut:", 21, 105 125 25 10, left
  edit "", 50, 130 125 10 10, left
  text "Slayer:", 22, 105 140 25 10, left
  edit "", 51, 130 140 10 10, left
  text "Farming:", 23, 105 155 25 10, left
  edit "", 52, 130 155 10 10, left
  text "Con:", 24, 105 170 25 10, left
  edit "", 53, 130 170 10 10, left
  text "Smith:", 25, 105 185 25 10, left
  edit "", 54, 130 185 10 10, left
}
alias google dialog -m google google
dialog google {
  title "Google - I'm Feeling Lucky Results"
  size -1 -1 200 25
  option dbu 
  edit "", 1, 5 5 190 10, center 
}
on *:dialog:google:init:*:{
  did -o google 1 1 %goog
  sockclose google
}
on *:dialog:nick:dclick:*:{
  query $gettok($did(nick,4).seltext,1,32)
}
alias nonick dialog -m nnick nnick
dialog nnick {
  title "Error", center
  size -1 -1 140 25
  option dbu 
  text "Please select a nickname from your friends list before you click the Remove button", 1, 5 5 130 15, center 
}
alias notext dialog -m ntext ntext
dialog ntext {
  title "Error", center
  size -1 -1 140 25
  option dbu 
  text "Please type a nickname into the edit box, then press submit.", 1, 5 5 130 15, center 
}
alias nowhois dialog -m nwhois nwhois
dialog nwhois {
  title "Error", center
  size -1 -1 140 25
  option dbu 
  text "Please select a nickname from your friends list before you click the whois button", 1, 5 5 130 15, center 
}
alias Russl dialog -m link link
dialog link {
  title "RussellReal's Scripting Forum"
  size -1 -1 140 25
  option dbu 
  text "RussellReal's Scripting Forum:", 1, 5 5 130 10, center 
  link "http://z7.invisionfree.com/Scripting_Fun/index.php", 2, 9 15 130 10, center
}
on *:dialog:link:sclick:2:{
  //run http://z7.invisionfree.com/Scripting_fun
}
alias whoisd dialog -m whois whois
dialog whois {
  title "Whois Results"
  size -1 -1 250 140
  option dbu 
  text "Hostmask", 1, 100 5 50 10, center
  edit "User is offline", 2, 5 16 240 10, center
  text "Identified?", 3, 100 31 50 10, center
  edit "User is offline or isn't identified", 4, 5 42 240 10, center
  text "Channels", 5, 100 56 50 10, center
  edit "User is offline", 6, 5 67 240 10, center
  text "Server", 7, 100 82 50 10, center
  edit "User is offline", 8, 5 93 240 10, center
  text "Idle Time", 9, 100 108 50 10, center
  edit "Idle Time UnRetrievable", 10, 5 119 240 10, center
}
alias nk dialog -m nick nick 
dialog nick {
  title "Russell's Friendslist"
  size -1 -1 127 242
  option dbu 
  text "Friends List, Created by RussellReal.", 10, 3 1 94 10, left
  text "Nickname To Add", 1, 3 7 94 10, left
  edit "", 2, 2 15 70 13, left 
  Button "Submit", 3, 74 15 25 13, Right
  list 4, 2 30 123 150, left
  button "Remove", 5, 22 177 83 21, left
  button "Query", 6, 1 177 20 10, left
  button "Notice", 7, 1 188 20 10, left
  button "Whois", 8, 106 177 20 10, left
  button "Invite", 9, 106 188 20 10, left
  button "My Site", 11, 100 1 23 9, right
  button "Clear All", 12, 99 15 25 13, Right 
  text "Google Search - I'm Feeling Lucky", 13, 1 200 126 10, center
  edit "", 14, 1 209 126 10, left
  button "Search!", 15, 30 220 66 10
  button "Rs Stat Look-Up!", 16, 30 231 66 10
}
on *:dialog:nick:close:*:{
  set %dialog.nick off
}
on *:dialog:nick:init:0:{
  set %dialog.nick on
  var %f = 0
  while (%f < $lines(friends.txt)) {
    inc %f 1
    did -a nick 4 $read(friends.txt, %f)
  }
  var %1 = 0
  while (%1 < $did(nick,4).lines) {
    inc %1 1
    did -o nick 4 %1 $gettok($did(nick,4,%1),1,32) $iif($notify($did(nick,4,%1)).ison == $true,online,offline)  
  }
}
on *:dialog:nick:sclick:*:{
  if ($did == 3) {
    if ($did(nick,2) != $null) {
      set %friend $did(nick,2).text
      notify %friend
      did -a nick 4 %friend
      write friends.txt %friend
      did -r nick 2
      while (%1 < $did(nick,4).lines) {
        inc %1 1
        if ($gettok($did(nick,4,%1),1,32) isin %friend) {
          did -o nick 4 %1 $gettok($did(nick,4,%1),1,32) $iif($notify($did(nick,4,%1)).ison == $true,online,offline)  
        }
      }
    }
    else { notext }
  } 
  if ($did == 5) {
    if ($did(nick,4).seltext == $null) { nonick }
    else {
      notify -r $did(nick,4).seltext 
      write -ds $+ $gettok($did(nick,4).seltext,1,32) friends.txt 
      did -d nick 4 $did(nick,4).sel
    }
  }
  if ($did == 6) { query $gettok($did(nick,4).seltext,1,32) }
  if ($did == 7) { notice $gettok($did(nick,4).seltext,1,32) $?="Enter The Message You Wish To Send To $gettok($did(nick,4).seltext,1,32) $+ " }
  if ($did == 8) {
    if ($did(nick,4).seltext == $null) { nowhois }
    else {
      set %Whois $gettok($did(nick,4).seltext,1,32)
      whois $gettok($did(nick,4).seltext,1,32)
      whoisd
      enable #whois
    }
  }
  if ($did == 9) { invite $gettok($did(nick,4).seltext,1,32) $?="Enter The Channel You Wish To Invite $did(nick,4).seltext Into" }
  if ($did == 11) { russl }
  if ($did == 12) { 
    var %a = 0
    while (%a < $did(nick,4).lines) {
      inc %a 1
      notify -r $gettok($did(nick,4,%a),1,32)
    }
    did -r nick 4
    remove friends.txt
  }
  if ($did == 15) {
    if ($did(nick,14) != $null) {
      /set %lookup $replace($did(nick,14),$chr(32),+)
      /sockopen google www.google.com 80
    }
    else { halt }
  }
  if ($did == 16) { RSHS }
}

#whois on
raw 311:* {
  if (%dialog.nick == on) {
    set %311 $3-
    did -r whois 2
    did -a whois 2 %311 
  }
}
raw 307:* {
  if (%dialog.nick == on) {
    set %307 $3-
    did -r whois 4
    did -a whois 4 %307 
  }
}
raw 313:* {
  if (%dialog.nick == on) {
    set %313 $3- 
  }
}
raw 312:* {
  if (%dialog.nick == on) {
    set %312 $3
    did -r whois 8
    did -a whois 8 %312 
  }
}
raw 317:* {
  if (%dialog.nick == on) {
    set %317 $duration($3)
    did -r whois 10
    did -a whois 10 %317 
  }
}
raw 319:* {
  if (%dialog.nick == on) {
    set %319 $3-
    did -r whois 6
    did -a whois 6 %319 
  }
}
#whois end
on *:NOTIFY:{
  if (%dialog.nick == on) {
    set %blah $nick
    var %h = 0
    while (%h < $did(nick,4).lines) {
      inc %h 1
      if ($gettok($did(nick,4,%h),1,32) isin %blah) {
        did -o nick 4 %h $gettok($did(nick,4,%h),1,32) online
      }
    }
  }
}
on *:UNOTIFY:{
  if (%dialog.nick == on) {
    set %blah1 $nick
    var %h = 0
    while (%h < $did(nick,4).lines) {
      inc %h 1
      if ($gettok($did(nick,4,%h),1,32) isin %blah1) {
        did -o nick 4 %h $gettok($did(nick,4,%h),1,32) offline
      }
    }
  }
}
on *:sockopen:google:{
  sockwrite -nt $sockname GET /search?hl=en&q= $+ %lookup $+ &btnI=I%27m+Feeling+Lucky HTTP/1.1
  sockwrite -nt $sockname Host: www.google.com $+ $crlf $+ $crlf
}
on *:sockread:google:{
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    sockread %temptext
    tokenize 32 $htmlfree(%temptext)
    if $1 == location: {
      set %goog $2
      google
    }
  }
}
on *:SOCKCLOSE:google:{
  unset %check
  unset %goog
  unset %temptext
}
on *:SOCKOPEN:dstat:{
  sockwrite -nt $sockname GET /statpage.php?user= [ $+ [ %lookup.d ] ]  HTTP/1.1
  sockwrite -nt $sockname Host: rscript.org $+ $crlf $+ $crlf
  if (%cmb) {
    sockrename $sockname dcmb
  }
  if (%skill) {
    sockrename $sockname dskill
  }
}
on *:SOCKREAD:dstat:{
  var %total | sockread -f %total
  tokenize 32 $remove(%total,Stat:)
  if (*does not feature* iswm $1-) { did -er stat 30-54 | sockclose $sockname }
  if (Overall == $1) { did -eo stats 32 1 $iif($3 isnum,$3,NA) }
  if (Attack == $1) { did -eo stats 33 1 $iif($3 isnum,$3,NA) }
  if (Hitpoints == $1) { did -eo stats 38 1 $iif($3 isnum,$3,NA) }
  if (Prayer == $1) { did -eo stats 39 1 $iif($3 isnum,$3,NA) }
  if (Strength == $1) { did -eo stats 34 1 $iif($3 isnum,$3,NA) }
  if (Defence == $1) { did -eo stats 35 1 $iif($3 isnum,$3,1) }
  if (Ranged == $1) { did -eo stats 37 1 $iif($3 isnum,$3,NA) }
  if (Magic == $1) { 
    did -eo stats 36 1 $iif($3 isnum,$3,NA)
    did -eo stats 31 1 $cmbcalc($did(stats,33),$iif($did(stats,35) != NA,$did(stats,35),1),$did(stats,34),$did(stats,38),$did(stats,39))
  }
  if (Herblore == $1) { did -eo stats 41 1 $iif($3 isnum,$3,NA) }
  if (Agility == $1) { did -eo stats 40 1 $iif($3 isnum,$3,NA) }
  if (Thieving == $1) { did -eo stats 42 1 $iif($3 isnum,$3,NA) }
  if (Crafting == $1) { did -eo stats 44 1 $iif($3 isnum,$3,NA) }
  if (Fletching == $1) { did -eo stats 45 1 $iif($3 isnum,$3,NA) }
  if (Slayer == $1) { did -eo stats 51 1 $iif($3 isnum,$3,NA) }
  if (Mining == $1) { did -eo stats 46 1 $iif($3 isnum,$3,NA) }
  if (Smithing == $1) { did -eo stats 54 1 $iif($3 isnum,$3,NA) }
  if (Fishing == $1) { did -eo stats 47 1 $iif($3 isnum,$3,NA) }
  if (Cooking == $1) { did -eo stats 48 1 $iif($3 isnum,$3,NA) }
  if (Runecraft == $1) { did -eo stats 43 1 $iif($3 isnum,$3,NA) }
  if (Firemaking == $1) { did -eo stats 49 1 $iif($3 isnum,$3,NA) }
  if (Woodcutting == $1) { did -eo stats 50 1 $iif($3 isnum,$3,NA) }
  if (Farming == $1) { did -eo stats 52 1 $iif($3 isnum,$3,NA) }
  if (Construction == $1) {
    did -eo stats 53 1 $iif($3 isnum,$3,NA)
    sockclose $sockname
  }
}
alias cmbcalc { 
  return $calc((0.32707*$1)+(0.249*$2)+(0.324*$3)+(0.25*$4)+(0.124*$5))
}