Greet Snippet

By Sparkie on Oct 25, 2008

Here is a snippet i wrote. To make it work type:
/hmake -s greet 1000

The functions are as follows:
@!.setgreet
@!.greet check
@!.del greet
@!.greets on
@!.greets off

on $*:TEXT:/^[.!@]g(reet(s)?)? on/Si:#:{
  set %greet = on
  if ($nick isop #) && ($nick ishop #) { 
    var %return = $iif($left($1,1) == @, msg $chan, .notice $nick)
    hload -s greet greet.txt
    msg # Join Greets have now been enabled in $chan
  }
}

on $*:TEXT:/^[.!@]g(reet(s)?)? off/Si:#:{
  unset %greet
  if ($nick isop #) && ($nick ishop #) { 
    var %return = $iif($left($1,1) == @, msg $chan, .notice $nick)
    //msg # Join Greets have now been disabled in $chan
  }
}

on $*:TEXT:/^[!@]setg(reet)?/Si:#:{
  var %return = $iif($left($1,1) == @, msg $chan, .notice $nick)
  if (%greet == $null) { %return Greets are currently disabled| halt }
  else {
    if ($2 == $null) { %return Please specify a greet }
    else if ($2 != $null) { %return Your Greet is Set as: $2- }
    hadd -s greet $address($nick,2) $2-
  }
}

on $*:TEXT:/^[.!@]g(reet)?( )?c(heck)?/Si:#:{
  var %return = $iif($left($1,1) == @, msg $chan, .notice $nick)
  if (%greet == $null) { %return Greets are currently disabled| halt }
  else { 
    %return Your current Greet is: $hget(greet,$address($nick,2))
  }
}

on *:JOIN:#:{
  if (%greet == $null) { halt }
  else {
    if ($hget(greet,$address($nick,2)) == $null) { halt }
    else { msg $chan [ $+ $nick $+ ]  $hget(greet,$address($nick,2)) }
  }
}

on $*:TEXT:/^[!@]del(ete)?( )?g(reet)?/Si:#:{
  if (%greet == $null) { Greets are currently disabled| halt }
  else {
    var %return = $iif($left($1,1) == @, msg $chan, .notice $nick)
    hdel -s greet $address($nick,2)
    %return Your Greet has been Deleted
  }
}

Comments

Sign in to comment.
SirJaxx   -  Dec 23, 2008

I can't get it to work

 Respond  
xt24   -  Nov 15, 2008

good job works for my bot

 Respond  
RusselB   -  Oct 27, 2008

Code shouldn't require the user to manually make the hash table each time.
Also, while there is a /hload command, there's no /hsave anywhere in the code (that I could see)

Thus, imo, this code is incomplete, making a 2/10 rating valid.

Also, the -s switches for the /hload, /hadd, and /hdel commands are, imo, a waste once it's been confirmed that the script is working.

 Respond  
Scakk   -  Oct 26, 2008

In the "Greet On" and "Greet Off" on text events you have var %return and yet have msg $chan in the uotput line. May want to use the %return varaibles or removes the line assigning it.

 Respond  
napa182   -  Oct 26, 2008

Well for one Bullet_Dodger you couldnt code it and for someone like you "A person that posts ripped codes trying to pass them off as his own." trying to tell someone else that things are unnecessary is a joke....

 Respond  
Blitzjager   -  Oct 26, 2008

I don't think you could make this /not/ pass the text limit even if you coded it better. O_o

 Respond  
Bullet_Dodger   -  Oct 26, 2008

It works Fine but still to unnessarsary whats he doing it for, to pass the text limit?

 Respond  
napa182   -  Oct 26, 2008

Bullet_Dodger said:

To much unnessarsary coding
Sorry But My Rating Is A Small 2/10 But i will test

a rate of 2 = incomplete

um the code works and is not incomplete.
as for the
" To much unnecessary coding "

if they clean it up and do the checks in the right way it will be fine, but then again everyone has their own style of coding.
my score still stands of 4/10

 Respond  
Bullet_Dodger   -  Oct 26, 2008

To much unnessarsary coding
Sorry But My Rating Is A Small 2/10 But i will test

 Respond  
Sparkie   -  Oct 26, 2008

Thanks, i'm trying to improve it at the moment

 Respond  
napa182   -  Oct 26, 2008

i really dont see the point in useing the regex's it's not like !setgreet is too long to type.
anyways...
you should just put all the on text events under one event to make it look alot cleaner.
as well on ur join even no real point in halting it if the nick isint in the hash.
4/10

 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.