mIRC Homepage
Posted By: idealife Duration Away on /Whois me? - 16/01/09 01:04 PM
Hello guys, I'm not sure this idea can work, but i remember some year ago a guy that show his duration away on whois, Every time when i did whois on him he showed his duration away. I've try to do it my self, it worked but not very good. I use KTE THEME i've modified the theme and add this code if (%::away) { %:echo $str($chr(160) ,14) $+(,%::c1) is away: %::away duration away: $duratie($awaytime) } that show this message 1:56p mynickname is away: away from keyboard (out to lunch) duration away: 14m but when i use another mirc for saw how look my duration away, i've see nothing message, basically message that i see first was only message for me and not for others. plus my modification showed away on every user that are away. NOW my question is can duration away see the light on whois? can this happen? please let me know. I really like to use this feature.
thank you
Posted By: genius_at_work Re: Duration Away on /Whois me? - 16/01/09 02:47 PM
The /echo command only shows information on your screen, nothing is sent to the server for others to see. You can use /notice or /msg or /describe if you want to send information to the server.

-genius_at_work
Posted By: idealife Re: Duration Away on /Whois me? - 16/01/09 02:54 PM
hello genius_at_work, thank you for explain how it working.
please can you do me a little code how to describe or how to sent my away duration on the server cos haven't idea how to do.

thank you again.
Posted By: sparta Re: Duration Away on /Whois me? - 16/01/09 03:23 PM
you should be able to just replace echo with ether describe or me..

/describe bla
/me bla

Posted By: idealife Re: Duration Away on /Whois me? - 16/01/09 04:13 PM
hello again, listen probably you misunderstood my question, i not want to show my duration away with /me or /describe that other on channel see it with command.
to make more simple check this image.

i want that, every time that a user did whois on me, my duration away appear on his window, so he can see me how much time i'm away, like how is on image, infact in image looks to be ok, but isn't, only work on my window, and not on other users, they can't see my duration.

please let me know. thank you again for your reply and suggestion. really appreciated from me.
Posted By: DJ_Sol Re: Duration Away on /Whois me? - 16/01/09 06:31 PM
That is a raw. I don't know which one it is.

You can use this to find out.

raw *:*:{
if (!$window(@raw)) window -e @raw
echo @raw $numeric $rawmsg
}

Then when you know the raw numeric for that line you can say.

raw <numeric>:*:{
if (duration isin $1-) { echo -a $1- }
}
Posted By: Horstl Re: Duration Away on /Whois me? - 16/01/09 08:02 PM
If others shall see your current away time every time they perform a /whois on you, and as the whois information isn't sent by you but the IRC server to the person doing the whois request, the script has to update your current away reason (technically it has to send a new away reason to the network), say, every minute.

The script has either to override the default away command, or (preferrable) be triggered by different means (custom command, popups or the like). Anyway, it has to store the away reason you give, and run a timer for the time you are away (as long as you are marked away, until the "back" raw is received), which does the update thingie. Other catchwords may be "multiserver" and "resume after reconnect"...

Do you set your away manually at the moment, or do you use a script or multiple scripts to go away (some autoaway script, away/back via popups, a custom away command...)? If you already use some scripted away, pleae try to find the relevant code parts and post 'em. smile
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 08:51 AM
Really have no idea at all, for me it is impossible to do away duration on whois, the guy that i saw once who had so, maybe he was an IRCop, or a person that have access on Server, so he had access on the server to edit the raw away and make it to say like that, <user is away> <message away> and <duration away>
because otherwise is impossible, if it was so easy why others not make it before? never see twice by anyone.

i'm using a simple costumized away menu, here is the code :

&Simple Away
$iif($away,Turn Back, Go Away):if ($away) { ame is back from away duration: $duration($awaytime) | away } | else { away $$input(Enter reason,129,Set Away) | ame ladies and gentlemen! have to go now... see you soon }
.-
.$chr(160) Silent $iif($away,Back,Away):if ($away) { echo back form away } | else { away $$input(Enter reason,129,Silent Away) | echo away is set }

otherwise like how is on image, i had to change on kte theme this code and add the duration how is in red:

if (%::away) { %:echo $str($chr(160) ,14) $+(,%::c1) is away: %::away - absence: $duratie($awaytime) }

this code works, but only for me, and that has a problem, if other user are away my duration show on their away too.

probably i've asked a stupid thing that is not possibile.
anyway thank you for reply, suggestion and your time for make it possible.
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 08:54 AM
DJ_Sol, you did good job to find raw number with this method, i've find it, is number 301
i tried but it does not work on your code too.
as i said, maybe is impossible to make it work.

thank you very much for your idea
Posted By: Tomao Re: Duration Away on /Whois me? - 17/01/09 11:02 AM
Perhaps this will do:

Code:
raw 311:*:$idle($2) | halt
alias -l idle { 
  if ($comchan($1,0)) { 
    var %c $comchan($1,0), %x, %n $1 | while (%c) { 
      %x = $addtok(%x,$duration($nick($comchan(%n,%c),%n).idle,3),32)
      dec %c 
    }
    .echo -q $nick $1 is away: duration: %x 
  }
}


Thank you, Wims.
Posted By: Wims Re: Duration Away on /Whois me? - 17/01/09 11:18 AM
/noop or /.echo -q should be used when you want to call a custom alias in this way, and there is an odd ",$chr(41))" in the $addtok line.
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 01:55 PM
hello!
no still not working on me, just tested mirc 6.35 and message
<mynickname> is away: Working
still no duration away after my away reason
Posted By: RusselB Re: Duration Away on /Whois me? - 17/01/09 02:43 PM
Try this
Code:
raw 301:*:{
  if $3 {
    set $+(%,away,.,$network,.,$2) $3-
  }
}
raw 317:*:{
  if $($+(%,away,.,$network,.,$2),2) {
    echo -a $2 is away for $v1 Duration: $duration($3)
  }
  else {
    echo -a $2 is not marked as away, but has an idle time of $duration($3)
  }
}
Posted By: Horstl Re: Duration Away on /Whois me? - 17/01/09 03:43 PM
Question is, who's getting you right...
I assumed you want a script to have your away time shown in a whois on you, which is not related to your theme or whois reply raws (= manipulation of the local display of the data you receive from the network, but yet not manipulating the data the network keeps end sends to whoissing users - aka your actual away reason).

If I got you right, replace the code you pasted above with the following:

Code:
menu status,channel,query {
  $iif(($status == connected),&Simple Away $iif($away,[you're away]))
  .$iif(($away && %awaywithtime.msg),Turn Back $+([gone $awaywithtime.duration,]),Go Away) : { 
    $iif(($away && %awaywithtime.msg),awaywithtime.back,awaywithtime.away)
  }
  .$iif(($away && %awaywithtime.msg),Turn Back $+([gone $awaywithtime.duration,]),Go Away) Silently : { 
    $iif(($away && %awaywithtime.msg),awaywithtime.back,awaywithtime.away) silent
  }
  .-
  .$iif(($away && %awaywithtime.msg),Change Away Reason $+([,%awaywithtime.msg,])) : {
    awaywithtime.change
  }
}

raw 305:*: { awaywithtime.unset } 
on *:disconnect: { awaywithtime.unset }

; go away
alias -l awaywithtime.away {
  away $$input(Enter away reason:,qeg,$iif(($1 == silent),Silent) Set Away)
  if ($1 == silent) { echo -agc info * You're now away $+([,$!,]) } 
  else { ame ladies and gentlemen! have to go now... see you soon $+([,$!,]) }
  set -e %awaywithtime.msg $!
  set -e %awaywithtime.time $ctime
  .timer.awaywithtime 0 60 away $(%awaywithtime.msg,0) - duration: $!awaywithtime.duration
}

; go back
alias -l awaywithtime.back {
  if ($1 == silent) { echo -agc info * You're now back form away $+([,$awaymsg,]) }
  else { ame is back from away $+([,$awaymsg,]) }
  away
  awaywithtime.unset
}

; change away reason
alias -l awaywithtime.change {
  set -e %awaywithtime.msg $$input(Enter new away reason:,qeg,Change Away Reason)
  away %awaywithtime.msg - duration: $awaywithtime.duration
}

; return away time (not resetting if reason is changed via script)
alias -l awaywithtime.duration { return $duration($calc($ctime - %awaywithtime.time),2) }

; stop updating and unset stored data (manual back/script back/disconnect)
alias -l awaywithtime.unset { .timer.awaywithtime off | unset %awaywithtime.* }

__________
Edit: Note that because the "away duration" is part of the away message sent to the network itself, you'll likely have to undo the changes you made to your theme. You'll never see other user's away duration in a whois, if they don't add it to their away reason like this script does. Also note that the script above isn't cappable of multiple server connections. smile
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 03:48 PM
thank you RusselB, your code work, even it says away doublicated like this:

<mynickname> is away: Working
<mynickname> is away for Working Duration: 4mins 8secs

just checked it from my mIRC, but i opened another mirc to look like it is another user, and did whois on the nick that have your code, but on window of "2nd mirc or like if it was another user" i see only <mynickname> is away: Working no duration
err frown it's impossible to see duration away from another mirc or another user.

I think dhe duration time must storage somewhere in mirc folder in a .txt, or .ini, so the code should check time every time away duration and reply when a user ask, only something like this probably can work. I'm sorry i do not want to suffer you guys, maybe i'm asking a stupid thing that isn't normal to ask.
so sorry guys, and thank you for time and code for me.
Posted By: MTec007 Re: Duration Away on /Whois me? - 17/01/09 03:55 PM
well for the duplicate problem try this:

Code:
raw 317:*:{
  if $($+(%,away,.,$network,.,$2),2) {
    echo -a $2 is away for $v1 Duration: $duration($3)
  }
  else {
    echo -a $2 is not marked as away, but has an idle time of $duration($3)
  }
  haltdef
}


the only problem with this entire 'subject' is that you cannot add this information to your whois permanently because this is simply not part of the IRC RFC.
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 03:58 PM
Horstl mate, your code work exatly. You did what i want, but i've see on status that said every minute my away status and in end i received this message on dalnet Too Many aways - Flood Protection activated looks like i'm flooding the network ?
Posted By: MTec007 Re: Duration Away on /Whois me? - 17/01/09 04:01 PM
it sounds like you have been typing /away too much. does that sound correct to you ?
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 04:08 PM
no i'm not typing away to much, just did one time only, but i see every minute on status this message You have been marked as being away even i not writte /away

maybe the code of Horstl, that work good check every minute server and in 4min after 4 message of You have been marked as being away in the end i got Too Many aways - Flood Protection activated from network
Posted By: MTec007 Re: Duration Away on /Whois me? - 17/01/09 04:10 PM
can you copy all your code for this script here, something is not working right
Posted By: Horstl Re: Duration Away on /Whois me? - 17/01/09 04:10 PM
You may modify the update delay, it's the 60 (60 seconds) in this line (chose a multiple of 60, like 180 (=3mins)):
Code:
.timer.awaywithtime 0 60 away $(%awaywithtime.msg,0) - duration: $!awaywithtime.duration

In the screenshot above you're on MindForge, which should allow more than one away reason per minute.

To hide the additional/repetitive display of your away status in your status window: if you only get the default message "You have been marked as being away" add this line to the script:
Code:
raw 306:*: if (%awaywithtime.msg) { haltdef }

If it's another message you see (for example part of your theme), you have to find and modify the respecitve "raw 306" line in your script.
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 04:12 PM
copy paste the code of Horstl above, that what i have and a clean mirc 6.35
Posted By: Horstl Re: Duration Away on /Whois me? - 17/01/09 04:18 PM
If a bigger update interval does not solve the "flood" issue, you're short of luck - networks limiting the number of away reasons render this script useless.
Posted By: 5618 Re: Duration Away on /Whois me? - 17/01/09 04:20 PM
Originally Posted By: MTec007
can you copy all your code for this script here, something is not working right

It's working perfectly normal, since his away message is updated every minute to show his away duration. See the /timer in Horstl's script.
Apparently that network doesn't like people setting a new /away message that often, so it will have to be changed to update less often.
Posted By: idealife Re: Duration Away on /Whois me? - 17/01/09 04:26 PM
yes, now work fine, big thanks to Horstl you improve my simple away even more better than before, you did the right what i'm looking for duration on whois, i was without a hope. Plus i want to thank every one that posted code, idea, suggestion on this thread god bliss you all.

Horstl, i'm doing intervals every 10min is more constant then every one or three minutes.

thanks a lot!
Posted By: idealife Re: Duration Away on /Whois me? - 20/01/09 06:07 PM
Horstl i'm using your code as away system, but what i saw it have problems with multiservers, can you make it to work for multiservers please?

thank you, and sorry to bump again.
Posted By: Horstl Re: Duration Away on /Whois me? - 20/01/09 08:45 PM
I'll have a look at it later.
Posted By: Horstl Re: Duration Away on /Whois me? - 21/01/09 03:28 AM
You can now set/remove/change your away status per network (more precisely: per server connection) or at all connections at once. You can choose for each option from "silently" (/echo only) or "with message" (/ame text).
Aways not initiated by the script (hence without the "duration" part added/updated) are taken into account in the popups menu (current away status/-time/-message) and in the channel messages. If you "change" the away reason of such an away, it will become an "away with time".

I did run some tests (non-evaliaton of away reasons in the /scon and /timer commands) - hope I didn't miss something... smile

Code:
; --- "Away with Time" (multiserver version) ---

; ••• MENU •••
menu status,channel,query {
  $iif(($awt.cons),Away with Time $iif($awt.count,$+([,away $iif(($awt.cons > 1),at $awt.count of $awt.cons),])))
  .$iif($away,Turn Back,Go Away) on this network $+([,$network,$iif($away,$chr(44) gone $iif($awt.duration,$v1,$duration($awaytime,2))),]))
  ..$iif($away,back,away) with message : $iif($away,awt.back,awt.away)
  ..$iif($away,back,away) silently : $iif($away,awt.back,awt.away) silent
  .$iif($away,Change Away Reason on this network $+([,$network,$chr(44) $iif($awt.reason,$strip($v1),$strip($awaymsg)),]))
  ..change with message : awt.change
  ..change silently : awt.change silent
  .-
  .$iif(($awt.count < $awt.cons),Go Away on all networks $+([away at $v1 of $awt.cons,]))
  ..away with message : awt.away.all
  ..away silently : awt.away.all silent
  .$iif(($awt.count),Turn Back on all networks $+([away at $v1 of $awt.cons,]))
  ..back with message : awt.back.all
  ..back silently : awt.back.all silent
  .$iif($away && ($awt.count > 1),Change Away Reason on all networks $+([away at $v1 of $awt.cons,])))
  ..change with message : awt.change.all
  ..change silently : awt.change.all silent
}

; ••• EVENTS •••
; "you're back"
raw 305:*: { awt.unset } 

; "you're now away" 
raw 306:*: if ($awt.reason) { haltdef }

on *:disconnect: { awt.unset }

; ••• ALIASES •••
; set the update delay here (N in seconds)
alias -l awt.delay { return 120 }

; go away on "current" network
alias -l awt.away {
  away $$input(Enter away reason:,qeg,Set Away $iif(($1 == silent),Silently) on $network)
  if ($1 == silent) { echo -agc info * You're now away. $+([,$!,$chr(15),]) } 
  else { ame ladies and gentlemen! have to go now... see you soon $+([,$!,$chr(15),]) }
  set -e $+(%,awt.msg.,$cid) $!
  set -e $+(%,awt.time.,$cid) $ctime
  $+(.timer.awt.,$cid) 0 $awt.delay away $!awt.reason $chr(15) $+ - duration: $!awt.duration
}

; go away on all networks (overriding previous aways)
alias -l awt.away.all {
  noop $$input(Enter away reasons:,qeg,Set Away $iif(($1 == silent),Silently) on all $awt.cons networks)
  scon -at1 away $($!,0) 
  if ($1 == silent) { echo -agc info * You're now away on all networks. $+([,$!,$chr(15),]) } 
  else { scon -at1 ame ladies and gentlemen! have to go now... see you soon $!+([,$!,$chr(15),]) }
  scon -at1 set -e $($+(%,awt.msg.,$cid),0) $($!,0)
  scon -at1 set -e $($+(%,awt.time.,$cid),0) $ctime
  scon -at1 $!+(.timer.awt.,$cid) 0 $!awt.delay away $!!awt.reason $chr(15) $+ - duration: $!!awt.duration
}

; turn back on "current" network
alias -l awt.back {
  away
  if ($1 == silent) { echo -agc info * You're now back. $+([,$awaymsg,$chr(15),]) }
  else { ame is back from away $+([,$awaymsg,$chr(15),]) }
  awt.unset
}

; turn back on all (away) networks
alias -l awt.back.all {
  if ($1 == silent) { echo -agc info * You're now back on all networks. }
  else { scon -at1 if ($away) ame is back from away $!+([,$awaymsg,$chr(15),]) }
  scon -at1 if ($away) awt.unset
  scon -at1 if ($away) away 
}

; change away reason of "current" network
alias -l awt.change {
  away $$input(Enter new away reason:,qeg,Change Away Reason $iif(($1 == silent),Silently) on $network,$awt.reason) $&
    $iif(($awt.duration),$chr(15) $+ - duration: $awt.duration)
  if ($1 == silent) { echo -agc info * Away reason changed. $+([,$!,$chr(15),]) }
  else { ame is away: $+([,$!,$chr(15),]) }
  set -e $+(%,awt.msg.,$cid) $!
  if (!$timer($+(.awt.,$cid))) { 
    set -e $+(%,awt.time.,$cid) $ctime
    $+(.timer.awt.,$cid) 0 $awt.delay away $!awt.reason $chr(15) $+ - duration: $!awt.duration
  }
}

; change away reason of all away networks (overriding previous aways)
alias -l awt.change.all {
  noop $$input(Enter new away reason:,qeg,Change Away Reasons $iif(($1 == silent),Silently) on $awt.count of $awt.cons networks)
  scon -at1 if ($away) away $($!,0) $!iif(($awt.duration),$chr(15) $!+ - duration: $!awt.duration)
  if ($1 == silent) { echo -agc info * Away resons changed on the $awt.count of $awt.cons networks you're away at. $+([,$!,$chr(15),]) }
  else { scon -at1 if ($away) ame is away: $!+([,$!,$chr(15),]) }
  scon -at1 set -e $($+(%,awt.msg.,$cid),0) $($!,0)
  scon -at1 if (!$timer($+(.awt.,$cid))) set -e $($+(%,awt.time.,$cid),0) $ctime
  scon -at1 if (!$timer($+(.awt.,$cid))) $!+(.timer.awt.,$cid) 0 $!awt.delay away $!!awt.reason $chr(15) $+ - duration: $!!awt.duration
}

; stop update and unset stored data (manual back/back via script/disconnect)
alias -l awt.unset { 
  $+(.timer.awt.,$cid) off
  unset $+(%,awt.*.,$cid)
}

; return away reason for "current" connection
alias -l awt.reason { return $($+(%,awt.msg.,$cid),2) }

; return away time for "current" connection (not resetting if changing away reason)
alias -l awt.duration {
  if $($+(%,awt.time.,$cid),2) { return $duration($calc($ctime - $v1),2) }
}

; return total connected connections 
alias -l awt.cons {
  var %n = 0 
  scon -at1 inc % $+ n
  return %n
}

; return total connections you're away at
alias -l awt.count { 
  var %n = 0
  scon -at1 if ($away) inc % $+ n
  return %n
}


Put the desired update interval at:
Code:
alias -l awt.delay { return 120 }
Posted By: Def1ant Re: Duration Away on /Whois me? - 21/01/09 05:39 PM
edit: was affraid so :p
Posted By: 5618 Re: Duration Away on /Whois me? - 21/01/09 05:44 PM
Originally Posted By: Def1ant
Havent had the time to read this all, but this is client (= person who does the whois) side?

a simple
Code:
/whois $nick $nick
did the trick for me, everyone i whois now (Quakenet) shows their idle time to me.

You should really read what it's all about. :P
Idle time != away time
Posted By: idealife Re: Duration Away on /Whois me? - 23/01/09 10:57 AM
Horstl, thanks a million for all what you've done, now your code is too perfect for me, more good then this cannot be. I appreciate much and proud to use under your name, Wish you all the best mate.
cheers!
Posted By: idealife Re: Duration Away on /Whois me? - 23/01/09 09:09 PM
hello Horstl, one more time, i'm sorry again...
want to know what is "noop" because when i try to use both silent & ame away multi server, got this message error: NOOP invalid command away is set anyway, but noop error haven't idea why show error. i was thought it was the peak of good, so sorry to bump again for 2nd time.
Posted By: RusselB Re: Duration Away on /Whois me? - 24/01/09 12:46 AM
Make sure you're using the latest version of mIRC, as older versions don't have the noop command.
Regretfully I can't remember what version the noop command was added in, but that's the only reason I can think of for that error.
Posted By: Wims Re: Duration Away on /Whois me? - 24/01/09 02:38 AM
Noop command was added in mIRC 6.17, but it's not a problem of mirc version, rather a script one here.
Posted By: idealife Re: Duration Away on /Whois me? - 24/01/09 08:42 AM
right, i was using mirc 6.16 that show noop error, i've just try on 6.35 and work fine.
so... ignore my last post. i'will use on latest mirc.
Posted By: Wims Re: Duration Away on /Whois me? - 24/01/09 02:51 PM
It's better to use the latest version, but note that /.echo -q is the same as /noop.
© mIRC Discussion Forums