All pastes #135519 Raw Edit

Stuff

public text v1 · immutable
#135519 ·published 2006-08-17 00:47 UTC
rendered paste body
alias statsclear { unset %printline1 | unset %stats.* } 
alias stat_check { 
  if (%printline1 != $null) { 
    if (%stats.Overall.level == $null) { set %stats.Overall.level N/A } 
    if (%stats.color.strip == on) { %stats.send %stats.text %stat.name - Skill Total: %stats.Overall.level %cmb.printline | %stats.send $strip(%printline1,cb) | statsclear | halt } 
    if (%stats.color.strip == $null) { %stats.send %stat.color1 $+ %stats.text $+ %stat.color2 %stat.name %stat.color1 $+ - Skill Total: $+ %stat.color2 %stats.Overall.level | %stats.send %printline1 | statsclear | halt } 
  } 
  else { %stats.send %stat.color1 $+ This person doesnt appear on the hiscores for any skill currently listed on the hiscores. | statsclear | halt } 
} 
on $*:text:/^[!@.](stats) .{1,13}$/Si:#:{ 
  if ($sock(stats).status != $null) { notice $nick The stats script is currently in use. Try again.... now! | halt } 
  if ($left($1,1) == @) && ($left($remove($chan(#).mode,+),1) == c) || ($left($remove($chan(#).mode,+),2) == c) { set %stats.color.strip on } 
  set %stats.nick $nick | set %stats.send $iif($left($1,1) == @,msg $chan,notice $nick) | set %stats.name $replace($2-,$chr(32),+) | set %stat.color1 $chr(3) $+ 13 | set %stat.color2 $chr(3) $+ 12
  sockopen stats vulcan.ueuo.com 80 
} 
on *:sockopen:stats:{ 
  sockwrite -nt $sockname GET /geniestats.php?rsname= $+ %stats.name HTTP/1.0 
  sockwrite -nt $sockname Host: vulcan.ueuo.com $+ $crlf $+ $crlf 
} 
on *:sockread:stats:{ 
  if ($sockerr > 0) { .notice %stat.called.nick Error: Try again later. | halt } 
  var %read | sockread %read 
  if (<b>Personal isin %read) { set %stat.name $remove(%read,Personal $+ $chr(32),Scores $+ $chr(32),For $+ $chr(32),<b>,</b>) | set %stats.text $remove(%read,<b>,</b>) | set %stats.text $left(%stats.text,- $+ $len(%stat.name)) } 
  tokenize 124 $remove(%read,Genie:) 
  if ($0 == 4) { set %printline1 %printline1 $eval($+(%stat.color1,$1,:,%stat.color2),2) $3 | set %stats. $+ $1 $+ .level $3 } 
} 
on *:sockclose:stats:{ stat_check } 
; ############################################################################# 
; ## Simple Multi-Socketed Price Guide Script                                ## 
; ## Written by CrazyMan1975                                                 ## 
; ## trulyinsane@crazyman.org                                                ## 
; ## irc.swiftirc.net - #RsPrices                                            ## 
; ##                        - NOTE -                                         ## 
; ## This script is actually NOTHING like the one that my main bot           ## 
; ## TrulyInsane1 uses. I put this together because I was asked enough       ## 
; ## times for a price guide script that worked well.                        ## 
; ## This one does the job, but if you want it fancy like Truly's then       ## 
; ## You're going to have to put in the hours. -.-                           ## 
; ############################################################################# 

; ############################################################################# 
; ## Alias/Identifier $preplace(<text>)                                      ## 
; ## This can be used to replace anything that the web site does not already ## 
; ## catch. Simply create a file called replace.txt in the main mirc         ## 
; ## directory, then add what you want to be replaced in the following       ## 
; ## Format: <text_to_replace>,<replacement_text>                            ## 
; ## Examples: drag pl8legs,Dragon Platelegs                                 ## 
; ##           potion (4),Potion                                             ## 
; ############################################################################# 
ALIAS -l PReplace { 
  VAR %pr.cnt = 1 | VAR %pr.total = $Lines(Replace.txt) | VAR %pr.text = $1- 
  WHILE (%pr.cnt <= %pr.total) { 
    VAR %pr.text = $Replace(%pr.text, [ [ $Read(Replace.txt,%pr.cnt) ] ] ) 
    INC %pr.cnt 
  } 
  RETURN %pr.text 
} 

; ############################################################################# 
; ## Remote Trigger, Allows !, @ or . to be used as the command character &  ## 
; ## price* to be used as the command.                                       ## 
; ############################################################################# 
ON $*:TEXT:/^[!@.]price/Si:#: { 
  IF (!$2) { .notice $nick [7,1Price Guide]: Please give me something to search for! | HALT } 
  ; # This sets up the Multiple Sockets, increasing the Variable %i until that socket is not in use. 
  VAR %i 1 
  WHILE ($Sock(price. $+ %i)) { INC %i } 
  ; # Store the Nickname, Where to send and how, and the item to find using our %i identifier. 
  SET %price.user. [ $+ [ %i ] ] $Nick 
  SET %price.target. [ $+ [ %i ] ] $IIF($Left($1,1) == !,.Notice $Nick ,.Msg $Chan) [9Your Price]:

  SET %price.search. [ $+ [ %i ] ] $PReplace($2-) 
  ; # Open the socket - http://thexx.6te.net 
  SockOpen $+(price.,%i) thexx.6te.net 80 
} 

; ############################################################################# 
; ## SockOpen - Once our socket has been opened, This will run.              ## 
; ## This sets up our request for the web page so we can retrieve the data.  ## 
; ## Note the price.* in the on SockOpen, that is Necessary to pick up the   ## 
; ## sequential socket names.                                                ## 
; ############################################################################# 
ON *:SOCKOPEN:price.*:{ 
  SockWrite -nt $SockName GET /xxprice.php?item= [ $+ [ $Replace(%price.search. [ $+ [ $Right($SockName,-6) ] ] ,$Chr(32),$Chr(37) $+ 20) ] ] HTTP/1.1 
  SockWrite -nt $SockName Host: thexx.6te.net 
  SockWrite -nt $SockName $CRLF 
} 


; ############################################################################# 
; ## SockRead - Now we're going to find the data and return it to the user.  ## 
; ############################################################################# 
ON *:SOCKREAD:price.*:{ 
  ; # Store the socket number in %i (Local Variable) 
  VAR %i = $Right($SockName,-6) 
  ; # Read a Line from the socket. 
  SockRead -f %priceread 
  ; # If something went wrong, report it to the user and clear the variables. 
  IF ($SockErr) { 
    %price.target. [ $+ [ %i ] ] Socket error: $SockErr $+ , while looking up %price.search. [ $+ [ %i ] ] 
    UNSET %price.*. [ $+ [ %i ] ] 
  } 
  ; # If nothing happened during the initial read process, we can begin. 
  ELSE { 
    :NextRead 
    SockRead -f %priceread 
    ; # $sockbr is set if data was actually read in to the %priceread variable. 
    IF ($SockBr) { 
      ; # For this site, the price info is preceeded with "TheXX.Co.Nr" so we'll look for that. 
      IF ((TheXX.Co.Nr IsIn %priceread) && ($NumTok(%priceread,32) > 1)) { 
        ; # Output the match we found to the user. 
        %price.target. [ $+ [ %i ] ] 13 $+ $Remove(%priceread,TheXX.Co.Nr $+ $Chr(32)) 
        UNSET %price.*. [ $+ [ %i ] ] 
      } 
      ; # if the Variable contains only "TheXX.Co.Nr" then we did not find a match, report it. 
      ELSEIF (%priceread == TheXX.Co.Nr) { %price.target. [ $+ [ %i ] ] Unable to find a match for $qt(%price.search. [ $+ [ %i ] ] ) } 
      ; # Goto's as a general rule are BAD, in an on SockRead event is the ONLY time I will use them. 
      GOTO NextRead 
    } 
    ELSE SockClose $SockName 
  } 
} 

; ############################################################################# 
; ## I hope this helps you out, and possibly you can learn a little about    ## 
; ## Sockets from it. Enjoy!                                                 ## 
; ## Not too shabby for 100 lines including comments ;)                      ## 
; #########
#################################################################### 
on *:TEXT:!calc*:#: {
  if ($3 == $null) /notice $nick 12 $2 =13 $calc( $2 )
  if ($3 != $null) /notice $nick 7Please dont use the space bar for the !calc7 trigger. Do it like this:  5+5 7for example.
}
alias c1 { return $+(,$1-) } 
alias c2 { return $+(,$1-) } 

on *:text:*:#: { if ($address($nick,2) == $readini(Ignore.ini,Ignore,$address($nick,2))) { /halt } { 

    tokenize 32 $strip($1-) 
    if ($left($1,1) !isin @!) halt 
    if ($right($1,-1) == pcw) var %style = pcworld 
    elseif ($right($1,-1) == pc-world) var %style = pcworld 
    elseif ($right($1,-1) == pcworld) var %style = pcworld 
    elseif ($right($1,-1) == world) var %style = pcworld 
    elseif ($right($1,-1) == pc-cash) var %style = pccash 

    set $+(%,stats.display.,%ID) $iif($left($1,1) == @,msg $nick,notice $nick) 

    alias process { 
      var %display = $($+(%,stats.display.,%ID),2) 

      if (%style == pcworld) { 
        if ($nick isop $chan || $nick ishop $chan || $nick isvoice $chan) { %display $c1(The current PC world is:) $c2($readini(PCWorld.ini,PC-World,PCWorld)) } 
        else { %display $c1(The current PC world is:) $c2(Get Voice to see!) } 
      } 
      elseif (%style == pccash) { 
        if ($nick isop $chan || $nick ishop $chan || $nick isvoice $chan || $address($nick,2) == $address($me,2)) { 
          if ($2 isnum 3-126) { 
            if ($3 isnum 1-50000) { 
              %display $c1(You will get) $c2($calc((10 * $$2) * $$3) $+ gp) $c1(for) $c2($$3) $c1(PC Games.) 
            } 
            else { %display $c1(Error... Please try again) } 
          } 
          else { %display $c1(Error... Please try again) } 
        } 
      } 
    } 
  } 
}
on *:text:*:?: { if ($nick isop #pain || $nick ishop #pain) { 

    tokenize 32 $strip($1-) 
    if ($left($1,1) !isin @!) halt 
    if ($right($1,-1) == setworld) var %style = setworld 
    elseif ($right($1,-1) == set-world) var %style = setworld 
    elseif ($right($1,-1) == ignore) var %style = ignore 
    elseif ($right($1,-1) == unignore) var %style = unignore 

    alias process { 

      if (%style == setworld) { 
        if ($2 isnum 1-132) { writeini PCWorld.ini PC-World PCWorld $replace($2,$chr(32),-) 
        amsg $c1(New PC World Type) $c2(!pcw/!pc-world/!world) $c1(to see the new World! World set by:) $c2($nick) } 
        else { msg $nick $c1(Please enter a valid world) } 
      } 
      elseif (%style == ignore) { 
        writeini Ignore.ini Ignore $address($$2,2) $replace($address($$2,2),$chr(32),-) 
        amsg $c1(The Address) $c2($address($$2,2)) $c1(has been Ignored) 
      } 
      elseif (%style == unignore) { 
        remini Ignore.ini Ignore $address($$2,2) $replace($address($$2,2),$chr(32),-) 
      } 
    } 
  } 
}