mIRC Home    About    Download    Register    News    Help

Print Thread
#203946 02/09/08 03:46 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I have the following
Code:
menu nicklist {
  Idle : echo -a $$1 has been idle on $chan for $duration($nick($chan,$$1).idle)
}
and it works, but, what I'd like, is to have the idle time just show in the menu when I select Idle, as the nick and the channel are already pre-determined, so I don't really need that in the display.

I tried
Code:
menu nicklist {
Idle : $duration($nick($chan,$$1).idle)
}

But that just gave me an Unknown command message, indicating the time being returned was trying to be used as a command (which makes sense)

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Something like this?

Code:
menu nicklist {
  Idle ( $duration($nick($chan,$$1).idle) ): noop
}

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Solution found
Code:
menu nicklist {
Idle
.$duration($nick($chan,$$1).idle) : noop
}


P.S.: Hixxy's suggestion also works, and actually looks better than what I had.

Last edited by RusselB; 02/09/08 04:29 AM.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
If you really want the :
Code:
menu nicklist {
  $style(2) Idle $+ $chr(58) $duration($nick($chan,$$1).idle): noop
}


$style(2) disables the menu item so you can't click it.

Note that the one caveat is that you can't use $chr to escape : with $submenu, but you shouldn't run into that one for a while.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2007
Posts: 218
V
Fjord artisan
Offline
Fjord artisan
V
Joined: Mar 2007
Posts: 218
The nicklist popup could get rather long when the idle time is high

Code:
menu nicklist {
  Idle  $replace($remove($duration($nick($chan,$$1).idle),ecs,ins,rs,ays,ks,ec,in,r,ay,k),w,w,d,d,h,h,m,m,s,s)))):/
}


PS - I've always used : / in a popup to do the kind of thing the OP asks for, just wondered if it makes a difference?
thanks.

Last edited by vexed2; 02/09/08 02:08 PM.
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It doesn't make a difference, but the whole point of this post was about using : in menu items, not the rest of his code.

In any case, a regsub would be far less code for the above replacement:

Code:
$+(Idle,$chr(58)) $regsubex($duration($nick(#,$$1).idle), /([a-z])[a-z]+/g, \1):noop


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2007
Posts: 218
V
Fjord artisan
Offline
Fjord artisan
V
Joined: Mar 2007
Posts: 218
very nice, i like that.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
tested your code, and it worked just fine
Code:
$+(Idle,$chr(58)) $regsubex($duration($nick(#,$$1).idle), /([a-z])[a-z]+/g, \1):noop

And then i tested to make something to see idle time in query window, but i don't know what to use instead of # sign, anyone that know and can share the info with me? smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Code:
$+(Idle,$chr(58)) $regsubex($duration($query($$1).idle), /([a-z])[a-z]+/g, \1):noop

Reference /help $query

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
ty, did forget about that one smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard