on text away script thing

By jsg55 on Jan 08, 2010

if someone says brb it sets them as being away, status will tell you if the person is away.

on $*:TEXT:/^[!@.]brb/Si:#:{
  if ($2 == $null) { writeini away.ini $nick reason No reason. }
  if ($2 != $null) { writeini away.ini $nick reason $remove($2-,$chr(36)) }
  msg # $nick is now away,4,0 reason: 2,0 $readini(away.ini, $nick, reason)
  writeini away.ini $nick away on | set %away [ $+ [ $nick ] ] on
  if ($readini(away.ini, $nick, away) == on) inc -c %time [ $+ [ $nick ] ]
}
on $*:TEXT:/^[!@.]status */Si:#:{ 
  if ($readini(away.ini, $2, away) == on) { notice $nick $2 is away,4,0 reason: 2,0 $readini(away.ini, $2, reason) }
}
on *:text:*:#:{
  if ($readini(away.ini, $nick, away) == on) {
  msg # $nick is now back 4,0 from: 2,0 $readini(away.ini, $nick, reason) and has been gone $duration(%time [ $+ [ $nick ] ])
  remini away.ini $nick away | remini away.ini $nick reason | unset %time [ $+ [ $nick ] ]
   }
}
on *:action:*:#:{
  if ($readini(away.ini, $nick, away) == on) {
  msg # $nick is now back 4,0 from: 2,0 $readini(away.ini, $nick, reason) and has been gone $duration(%time [ $+ [ $nick ] ])
  remini away.ini $nick away | remini away.ini $nick reason | unset %time [ $+ [ $nick ] ]
   }
}

Comments

Sign in to comment.
bandbonjtv   -  Jan 30, 2013

IM NO EXPERT!
this is what i came up with from jsg55's script for my bot, thank you jsg55. i couldnt figure out how to get the script to read the nickname in the text to automatically trigger. ex: "where is john?" the script would then return the status for "john" like i wrote below. or how to get this lil peice of code into the script. preferably the auto trigger anywhere in text. please help if you can, so i can clean up the code im using and also learn more. thank you.

snippet - it only works if i have it in a different file for some reason. please help me include it or make it automatically trigger upon mention of $nick in chat by any user. wether they have a status or not. if they do, then display status, if not, then display alternate generic status.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on :text:!status :#:{
if ($readini(away.ini, $2, away) == on) {
msg $chan $2 is $readini(away.ini, $2, reason) and has been gone $duration(%time [ $+ [ $2 ] ]) }
if ($readini(away.ini, $2, away) != on) {
msg $chan $2 is either Watching the show, or Silently Lurking. If they dont respond, Try harder. } }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on $:text:/^(brb|bbl|afk|bbiab)\b/Si:#:awaycheck $1-
on $
:action:/^(brb|bbl|afk|bbiab)\b/Si:#:awaycheck $1-

alias -l awaycheck {
if ($2 == $null) { writeini away.ini $nick reason lurking. }
if ($2 != $null) { writeini away.ini $nick reason $remove($2-,$chr(36)) }
msg # $nick is now $readini(away.ini, $nick, reason)
writeini away.ini $nick away on | set %away [ $+ [ $nick ] ] on | set %time [ $+ [ $nick ] ]
if ($readini(away.ini, $nick, away) == on) inc -c %time [ $+ [ $nick ] ]
}
on :text::#:awaycheck2 $1-
on :action::#:awaycheck2 $1-

alias -l awaycheck2 {
if ($readini(away.ini, $nick, away) == on) {
msg # welcome back $nick $+ , You were gone $duration(%time [ $+ [ $nick ] ])
remini away.ini $nick | unset %away [ $+ [ $nick ] ] on | unset %time [ $+ [ $nick ] ] }
}
}

 Respond  
GuitarMasterx7   -  Jan 14, 2010

were not all experts like u Jethro_
cries

 Respond  
Jethro   -  Jan 14, 2010

I'm beginning to see more and more people use regex, but they still use one text per trigger, which makes me wonder why....WHY?

 Respond  
slub77   -  Jan 13, 2010

i am going to rate this because no one ever does

 Respond  
jsg55   -  Jan 08, 2010

hm yeah i see what you mean, ty for the info :)

 Respond  
TheNitelyfe   -  Jan 08, 2010

Pretty good, but some things can be changed for the better...

  if ($2 == $null) { writeini away.ini $nick reason No reason. }
  if ($2 != $null) { writeini away.ini $nick reason $remove($2-,$chr(36)) }

$iif can play a big part in this, and it can be changed to

writeini away.ini $nick reason $iif($2-,$remove($v1,$chr(36)),No reason.)

In this

 msg # $nick is now away,4,0 reason: 2,0 $readini(away.ini, $nick, reason)

You can just use $remove($2-,$chr(36)) since it's still in the on TEXT event.

But overall it's good, but I prefer hash tables. 7/10

 Respond  
GuitarMasterx7   -  Jan 08, 2010

looks good =D

 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.