SwiftIRC
IRC Discussion and Support
 
  Index  •  FAQ  •  Search  

It is currently Thu Sep 09, 2010 3:15 pm




Post new topic Reply to topic  [ 3 posts ] 
 !pcw 
Author Message
 Post subject: !pcw
PostPosted: Thu Aug 13, 2009 5:44 pm 
User
User

Joined: Thu May 07, 2009 9:42 pm
Posts: 37
Location: #ChaosScript
simple pc world setter !setpcw to set the pcw and !pcw to view the pcw.

Code:
on $*:TEXT:/^[!@.]Setpcw/Si:#: {
  if ($2 !isnum) || ($2 > 170) || ($3 != $null) || ($2 == $null) { notice $nick you need to select a PC world between 1-170 | halt
  }
  if ($nick isop $chan) || ($nick ishop $chan) {
    set %pcw [ $+ [ $chan ] ] $2
    set %pcsetter [ $+ [ $chan ] ] $nick
    set %pcwtime [ $+ [ $chan ] ] $ctime
    msg $chan 14[ 4PEST CONTROL 14]: The Pest Control World has changed! Type 4!Pcw14 to view it!
  }
  else notice $nick Sorry, you need Op or Half-Op to set a PCW!
}
on $*:TEXT:/^[!@.]Pcw/Si:#: {
  var %pc $iif($left($1,1) == @,msg $chan,notice $nick)
  if (%pcw [ $+ [ $chan ] ] == $null) {
    notice $nick There is no PCW set for this channel! | halt
  }
  else %pc 14[ 4PEST CONTROL 14]: The current 4PCW14 for $chan is4 %pcw [ $+ [ $chan ] ]  14set by4 %pcsetter [ $+ [ $chan ] ] 14|4 $duration($calc($ctime - %pcwtime [ $+ [ $chan ] ] )) 14ago.

}

_________________
owner of ChaosScript - (¯¯ChaosScript¯¯)™


Offline
 Profile E-mail  
 
 Post subject: Re: !pcw
PostPosted: Thu Aug 13, 2009 5:49 pm 
User
User

Joined: Tue Aug 04, 2009 3:49 pm
Posts: 233
Location: Illinois
Just a few tips..
Code:
if ($2 !isnum) || ($2 > 170) || ($3 != $null) || ($2 == $null) { blah }
could be shortened to
if ($2 !isnum 1-170) { blah }

When setting a variable, you don't need evaluation brackets ;p so you could do "set %pcw $+ $chan $2"
And also,
Code:
if (%pcw [ $+ [ $chan ] ] == $null) {
could be
if (!%pcw [ $+ [ $chan ] ]) {

Edit: sorry :p nice script

_________________
Image


Offline
 Profile  
 
 Post subject: Re: !pcw
PostPosted: Sun Aug 16, 2009 5:22 pm 
User
User

Joined: Sun Mar 22, 2009 2:31 am
Posts: 43
Location: #ethong
Hey, nice script but shortened i would make it like this...

Code:
on $*:TEXT:/^[!@.]Setpcw/Si:#: {
  if ($2 !isnum 1-170) { notice $nick you need to select a PC world between 1-170 | halt
  }
  if ($nick isop $chan || $nick ishop $chan) {
    set %pcw [ $+ [ $chan ] ] $2
    set %pcsetter [ $+ [ $chan ] ] $nick
    set %pcwtime [ $+ [ $chan ] ] $ctime
    msg $chan 14[ 4PEST CONTROL 14]: The Pest Control World has changed! Type 4!Pcw14 to view it!
  }
  else notice $nick Sorry, you need Op or Half-Op to set a PCW!
}
on $*:TEXT:/^[!@.]Pcw/Si:#: {
  var %pc $iif($left($1,1) == @,msg $chan,notice $nick)
  if (!%pcw [ $+ [ $chan ] ]) {
    notice $nick There is no PCW set for this channel! If you wish to set one you can type !setpcw 1-170. | halt
  }
  else {
%pc 14[ 4PEST CONTROL 14]: The current 4PCW14 for $chan is4 %pcw [ $+ [ $chan ] ]  14set by4 %pcsetter [ $+ [ $chan ] ] 14|4 $duration($calc($ctime - %pcwtime [ $+ [ $chan ] ] )) 14ago.
}
}


FFS, sorry got kicked off laptop, screwed up


Offline
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


 Who is online 

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 
Index  |  FAQ  |  Search

phpBB skin developed by: John Olson
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group