All pastes #368840 Raw Edit

Stuff

public text v1 · immutable
#368840 ·published 2007-02-23 11:16 UTC
rendered paste body
PCW SCRIPT
menu * { 
  PCW System --> 
  ..PCW Dialog:/dialog -m PCW PCW 
} 
dialog PCW { 
  title "PCW Dialog | Made By: Jdawg140 ©" 
  size -1 -1 160 60 
  option dbu 
  button "Ok", 1, 0 0 37 60, ok 
  button "Cancel", 2, 123 0 37 60, cancel 
  edit "Script By Jdawg140 © ", 3, 50 0 60 12, center 
  edit "World", 4, 50 12 60 12, center 
  edit "#Channel", 6, 50 24 60 12, center 
  button "Set PCW", 5, 50 36 60 24, center 
} 
on *:DIALOG:PCW:sclick:5:{ 
  set %pcw $+ $did($dname,6) $did($dname,4) 
  set %nick3 $+ $did($dname,6) $me 
  set %pcwtime $+ $did($dname,6) $ctime 
  msg $did($dname,6) PestControl world updated by $me $+ . Type !pcw to view the world. 
} 
ON *:TEXT:!pcw:#:{ if ($nick isreg $chan) { halt } 
  if (%pcw [ $+ [ $chan ] ] == $null) { 
    notice $nick There is no set World. 
  } 
  else { 
    notice $nick The current PestControl world is: %pcw [ $+ [ $chan ] ] Set by: %nick3 [ $+ [ $chan ] ] $+ $duration($calc( $ctime - %pcwtime [ $+ [ $chan ] ] )) ago. 
    unset %away $+ $nick ago. 
  } 
} 
ON *:TEXT:!setpcw*:#:{ 
  if ($2 == $null) { notice $nick ERROR: !setpcw <world 2-138> 
    halt 
  } 
  if ($nick isop $chan || $nick ishop $chan && $2 isnum 2-138) { 
    set %pcw $+ $chan $2 
    set %nick3 $+ $chan $nick 
    set %pcwtime $+ $chan $ctime 
    msg $chan PestControl world updated by $nick $+ . Type !pcw to view the world. 
    halt 
  } 
  if ($2 == 1) { 
    notice $nick ERROR: 1 is a f2p server 
    halt 
  } 
  if ($2 isletter A-Z) || ($2 isletter a-z) { 
    notice $nick ERROR: I did not know $2 was a number... 
    halt 
  } 
  else { 
    notice $nick ERROR: Are you halfop? No your not. 
  } 
} 
CW SCRIPT
on *:TEXT:!setcw*:#: {
  if ($2 < 139) {
    if ($nick isreg $chan || $nick isvoice $chan) { notice $nick you need a HalfOp+ to use this command.. | halt }
    if ($nick isop $chan || $nick ishop $chan) && ($2 isnum) {
      set %cw.world. [ $+ [ $chan ] ] $2
      set %cwnick. [ $+ [ $chan ] ] $nick
      set %cw.time. [ $+ [ $chan ] ] $ctime
      notice $nick The Castle Wars World has been changed to $2 $+ .
      msg $chan The Castle War World has changed type !cw to veiw it.
    }
  }
}
on $*:TEXT:/^[!@.]cw/Si:#: {
  if (%cw.world. [ $+ [ $chan ] ] == $null) { notice $nick There isn't currently a Castle Wars World set for $chan  | halt }
  inc %cwused
  if ($nick ishop $chan || $nick isop $chan || $nick isvoice $chan || $nick isreg $chan) { notice $nick The Castle Wars World is %cw.world. [ $+ [ $chan ] ] set $duration($calc($ctime - %cw.time. [ $+ [ $chan ] ] )) by %cwnick. [ $+ [ $chan ] ] This command has been used %cwused times.
  }

}


on *:TEXT:!unsetcw*:#: {
  if ($nick isreg $chan || $nick isvoice $chan) { notice $nick You need to be Halfop+ to do that. | halt }
  if ($nick isop $chan || $nick ishop $chan) {
    unset %cw.world. [ $+ [ $chan ] ] 
    unset %cwnick. [ $+ [ $chan ] ] 
    unset %cw.time. [ $+ [ $chan ] ] 
    notice $nick The Castle Wars World has been unset for $chan $+ !! =(
  }
}
price script
on $*:TEXT:$(/^(?>\Q $+ $me $+ \E,? ?)?([!.@~]price)/Si):*:{ 
  if (($readini(dchans.ini, dchans, $chan) == on) && ($me !isin $1)) /halt 
  /tokenize 32 $iif($me isin $1,$deltok($1-,1,32),$1-) 
  if (!$2) { 
    .notice $nick No item entered. 
  } 
  ;;; Loops through the sockets to find the first open one.;;; 
  else { 
    var %x = 1 
    while ($sock($+(Price.,%x))) { 
      inc %x 
    } 
    ;;; Set vars and open socket;;; 
    set $+(%,price.target,.,%x) $iif($left($1,1) == @ && ($nick !isreg $chan),.msg $chan,.notice $nick) 
    set $+(%,price.search,.,%x) $replace($2-,$chr(32),+) 
    sockopen $+(Price,.,%x) www.o-ss.net 80 
  }  
} 
On *:SockOpen:Price.*:{ 
  var %id = $right($sockname,-6) 
  sockwrite -nt $sockname GET /parsers/price.php?item= $+ $eval($+(%,price.search,.,%id),2) HTTP/1.1 
  sockwrite -nt $sockname Host: www.o-ss.net $+ $crlf $+ $crlf 
} 

On *:SockRead:Price.*:{ 
  var %id = $right($sockname,-6) 
  var %target = $eval($+(%,price.target,.,%id),2) 
  if ($sockerr) { 
    %target A socket error has occured, please try again later. 
    /cleanup %id 
    /halt 
  } 
  ;;; Opens an Infinate loop to find results;;; 
  /var %read 
  /sockread %read 
  /tokenize 32 %read 
  if (*END* iswm $1-) { 
    /inc %matches. [ $+ [ %id ] ] 
    /set %results. [ $+ [ %id ] ] $(%results. [ $+ [ %id ] ],2) $iif(%results. [ $+ [ %id ] ],$col1($+($chr(2),$chr(124),$chr(2))),$chr(32)) $col2($deltok($1-,$0,32)) 
  } 
  if (DONE isin $1-) { 
    if (!%matches. [ $+ [ %id ] ]) { 
      %target $col1(No matches found) 
      /cleanupr %id 
    } 
    if (%matches. [ $+ [ %id ] ]) { 
      %target $col1(Returning) $col2(%matches. [ $+ [ %id ] ]) $col1(results:) 
      %target %results. [ $+ [ %id ] ] 
      /cleanupr %id 
    } 
  } 
} 
;;; Local aliases for running the script.;;; 

alias -l col1 { 
  return $+($chr(3),2,$1-,$chr(3)) 
} 

alias -l col2 { 
  return $+($chr(3),10,$1-,$chr(3)) 
} 

alias -l cleanupr { 
  sockclose price. $+ $1 
  unset $+(%,Price,.,*,.,$1) 
  unset %matches. [ $+ [ $1 ] ] 
  unset %results. [ $+ [ $1 ] ] 
} 
LANGUAGE TRANSLATER :D
menu channel { 
  Translator:/dialog -ma Translater_Dialog Translater_dialog 
} 
on *:DIALOG:Translater_dialog:sclick:4,1:{ 
  if ($did == 4) { /set %translate-from $did(4).seltext } 
  if ($did == 1) { /set %translate-too $did(1).seltext  } 
} 

on *:DIALOG:Translater_dialog:init:*:{ 
  /did -a Translater_dialog 4 French 
  /did -a Translater_dialog 4 Spanish 
  /did -a Translater_dialog 4 German 
  /did -a Translater_dialog 4 Italian 
  /did -a Translater_dialog 4 English 
  /did -a Translater_dialog 1 French 
  /did -a Translater_dialog 1 Spanish 
  /did -a Translater_dialog 1 German 
  /did -a Translater_dialog 1 Italian 
  /did -a Translater_dialog 1 English 
} 

alias translate { /dialog -ma Translater_dialog Translater_dialog } 

on *:DIALOG:Translater_dialog:edit:8:{ /set %translate-text $replace($did(8),$chr(32),$+(%,2,0)) } 

on *:DIALOG:Translater_dialog:close:*:{ translate-text } 

dialog Translater_dialog { 
  title "Translater_dialog" 
  size -1 -1 188 141 
  option dbu 
  list 1, 124 28 50 50, sort size 
  button "Translate", 2, 12 123 78 12, ok 
  button "Cancel", 3, 99 123 75 12, cancel 
  list 4, 58 28 50 50, sort size 
  text "Translate from?", 5, 60 19 45 8 
  text "Translate too?", 6, 128 20 42 8 
  box "Translater", 7, 5 5 181 133 
  edit "", 8, 36 97 50 10, autohs 
  box "Text To Translate", 9, 24 88 72 26 
  box "Languges", 10, 55 11 129 70 
  text "Welcome to the translater dialog please select a languge to translate from and a languge to translate too then enter your text to translate.", 11, 10 22 42 58 
} 

alias -l translate-text { 
  sockopen lang ets.freetranslation.com 80 
} 
on *:SOCKOPEN:lang:{ 
  sockwrite -n $sockname GET /?srcText= $+ %translate-text $+ &mode=html&template=results_en-us.htm&sequence=core&language= $+ %translate-from $+ $+(%,2,F) $+ %translate-too HTTP/1.1 
  sockwrite -n $sockname Host: ets.freetranslation.com $+ $crlf $+ $crlf 
} 
on *:SOCKREAD:lang:{ 
  if ($sockerr) { /echo -a Sorry $nick There was a problem connecting to the site, try again soon. | { /halt } } 
  else { 
    var %outcome-looks-? 
    sockread -f %outcome-looks-? 
    if (*textarea name="dsttext" cols="40" rows="6"* iswm %outcome-looks-?) { /dialog -ma Translater_Dialog_ Translater_Dialog_ | /did -a Translater_dialog_ 1 $html-just-ditch-it($remove(%outcome-looks-?,$chr(9))) | /unset %translate* %%outcome-looks-? | { /halt } } 
    if ($sockerr) { /echo -a Sorry $nick There was a problem connecting to the site, try again soon. } 
  } 
} 

alias -l html-just-ditch-it { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
} 

dialog Translater_Dialog_ { 
  title "Translater Dialog" 
  size -1 -1 169 88 
  option dbu 
  text "Here is the Translated text you wanted.", 2, 17 16 144 16 
  box "Finished", 3, 8 5 157 79 
  button "Close", 4, 13 69 74 12, cancel 
  button "Translate something else", 5, 91 69 67 12, ok 
  combo 1, 18 34 132 34, size 
} 

on *:DIALOG:Translater_Dialog_:sclick:5:{ /.timer 1 1 /dialog -ma Translater_Dialog Translater_Dialog }