OK, I am thoroughly confused on this one.
I have been fiddling around making a few scripts. I made a "away" script. (It does not use mIRC's away system though)
I have it set where whenever I type "/away" it changes my name to "Nick-away", and it sets a timer (%awaytime).
I also have it where whenever someone queries me, it displays a message (I am not here.)
Now, my question.
How can I take the current time, and subtract the %awaytime, so it will display how many hours, minutes, seconds I have been "away".
Basically, I want to take the current time, and subtract a set variable from it.
PLEASE HELP!!
when u are /away u can set a variable with $ctime
set %awaytime $ctime
and when u're back u can return the time u are away with
$duration($calc($ctime - %awaytime))
ok, I did that, "$duration($calc($ctime - %awaytime))"
and it returned it in this format: "I have been away for -126secs"
How can I make it say "2mins 06secs"
well, u forgot the set the variable
//set %awaytime $ctime
alias away2 {
if (.server.net isin $server) {
/nickaway
/set %awaytime $ctime
}
}
on 1:TEXT:*:?:{
if (away isin $me) {
/query -n $nick I am not here right now. I have been away for $duration($calc(%awaytime - $ctime))
}
}
that is what i have. It works right, it just doesn't display the time in the right format.
$duration($calc($ctime - %awaytime))
wouldn't it just be simpler to create a timer that runs every second and increments a variable? then use $duration to get the time?!
it takes two lines of code!
set %awaytime 0
.timerAwaytime 0 1 { inc %awaytime 1 }
then all you have to do is use $duration(%awaytime) to get your total time away!
no, i think it's better to use that way with the $ctime
and brad2 i copied my command wrong
I can see your point. But for those of use who are lazy :P
"wouldn't it just be simpler to create a timer that runs every second and increments a variable?"
You don't need a timer to do that, /inc -c %varname
/help /inc
/inc [-cszuN] <%var> [value]
This increases the value of %var by value.
If you specify the -uN switch, %var is increased by the value once and then %var is unset N seconds later, assuming it is not set again by another script.
The [color:#0000C9]-c switch increases %var once per second.[/color]
The -z switch decreases %var until it reaches zero and then unsets it.
True... I'd completely forgotten :P
But I like the $ctime one now that I've been mucking around with it...
I dislike variables alot now :P
just use - $duration($awaytime)
-
Thanks! I put this in: $duration($calc($ctime - %awaytime))
I had the $ctime and %awaytime backwards. Works perfect now!
$duration($awaytime) won't work if you've got a script that marks you back and does a lot of other things.
Just try it and you'll see what I mean.
for instance:
alias markback {
msg $chan i'm back (after $duration($awaytime) $+ )
away
}
The above code will not return your time spent away, simply because of how a script is executed.
Of course, it may just be my experiences, but I'm fairly confident that you can't really use $awaytime.
Excuse me guys, but please read:
I have been fiddling around making a few scripts. I made a "away" script. (It does not use mIRC's away system though)
I am aware of that.
I was merely pointing out that $awaytime won't work if you try and use it in a back msg.
Just tested it with the exact same alias you used and it worked perfectly every time.
I personally will never understand the purpose of announcing that you are Away or Back, unless of corse you were in the midst of a conversation and had to run AFK quickly.
Most people are uninterested if you go Away, especiall if it's automatically after N minutes of inactivity. If someone really wants to know if you're away, they will type: /Whois <YourNick> <YourNick> (putting your nickname twice, will query your remote server directly... which includes your away status and idle time)
I know smaller channels might be alright with posting /away and /back messages, but please keep in mind that most channels really Dont Care if you're away. </rant>
- Raccoon
/Whois <YourNick> <YourNick> (putting your nickname twice, will query your remote server directly... which includes your away status and idle time)
heh ... learn something new everyday