Difference between revisions of "$nick (nick)"
m (added an example with .idle, fixed a typo) |
m (added wiki links and removed a some what pointless see also link.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 25: | Line 25: | ||
[[var]] %i = 1 | [[var]] %i = 1 | ||
− | [[while_loops|while]] (%i <= $nick(#, 0)) { | + | [[while_loops|while]] (%i <= $nick(#help.script, 0)) { |
− | [[echo]] -a $nick(#help.script, %i).pnick has been | + | [[echo]] -a $nick(#help.script, %i).pnick has been idle for [[$duration]]($nick(#help.script, %i).idle) |
− | inc %i | + | [[inc]] %i |
} | } | ||
The example above returns all nicks on the channel with their prefixes and idle time. | The example above returns all nicks on the channel with their prefixes and idle time. | ||
The output could e.g. be: | The output could e.g. be: | ||
− | @BlackShroud has been | + | @BlackShroud has been idle for 17hrs 30mins 28secs |
− | @Dana has been | + | @Dana has been idle for 14hrs 24mins 9secs |
− | @epicaL has been | + | @epicaL has been idle for 2days 7hrs 49secs |
− | @Microbe has been | + | @Microbe has been idle for 6hrs 19mins 45secs |
To get longest idle time on channel: | To get longest idle time on channel: | ||
alias idletest { | alias idletest { | ||
var %i = 1, %idle = 0, %nick | var %i = 1, %idle = 0, %nick | ||
− | + | while (%i <= $nick(#, 0)) { | |
− | [[if]] ($nick(#, %i).idle > %idle) { | + | [[if]] ($nick(#, %i).idle > %idle) { |
%idle = $nick(#, %i).idle | %idle = $nick(#, %i).idle | ||
%nick = $nick(#, %i) | %nick = $nick(#, %i) | ||
} | } | ||
− | [[inc]] %i | + | [[inc]] %i |
} | } | ||
− | [[msg]] $chan %nick has the longest idle on $chan that is $duration(%idle) | + | [[msg]] $chan %nick has the longest idle time on $chan that is $duration(%idle) |
} | } | ||
− | Returns e.g.: epicaL has the longest idle on #help.script that is 2days 7hrs 30mins 21secs | + | Returns e.g.: epicaL has the longest idle time on #help.script that is 2days 7hrs 30mins 21secs |
− | == | + | == Note == |
− | + | The ''idle'' property only holds information that your client has seen. | |
+ | If a user has been idle since you've joined that channel the users idle time will be the length you've been in the channel. | ||
+ | |||
+ | Therefore the ''idle'' property will not match the idle time a server returns in [[Raw 317]] as that is a clients idle time, not a user on a said channel. | ||
+ | |||
+ | == See Also == | ||
* Usage of property ''pnick'' in tutorial [[How_do_I_customize_mIRC's_own_output]] | * Usage of property ''pnick'' in tutorial [[How_do_I_customize_mIRC's_own_output]] | ||
[[Category:Nick and Address Identifiers]] | [[Category:Nick and Address Identifiers]] |
Latest revision as of 15:46, 31 October 2010
Returns Nth nickname in the channels nickname listbox on channel #.
$nick(#, N/nick, aohvr, aohvr)
First parameter marks for channel. Channel can be defined as #channel or as $chan or # what marks for channel the script was triggered/executed. Second parameter N can be integer for Nth nick at channel, or person's nickname on channel. Rest of parameters are optional.
Both aohvr parameters are optional. The first specifies which nicks you'd like included, and the second specifies the nicks you'd like excluded, where:
a = all nicks, o = ops, h = halfops, v = voiced, r = regular
The identifier $nick takes color, pnick, idle as possible properties.
color returns the color of nick in nicklist specified in mIRC's options. pnick returns the nickname with prefixes in a @%+nick format. idle returns the time in secods the user has been idle in specified channel.
Examples
$nick(#foo, 0) ;returns the the total number of nicknames on #foo $nick(#foo, 1) ;returns the 1st nickname on #foo $nick(#foo, 1, v) ;returns the 1st voice on #foo $nick(#foo, 0, r) ;returns the number of regular people on #foo $nick(#foo, 0, a, ov) ;returns the total number of nicks on channel #foo excluded ops and voices. $nick(#foo, Dana).idle ;returns the idletime (on channel) in seconds for the nickname Dana on #foo
var %i = 1 while (%i <= $nick(#help.script, 0)) { echo -a $nick(#help.script, %i).pnick has been idle for $duration($nick(#help.script, %i).idle) inc %i }
The example above returns all nicks on the channel with their prefixes and idle time. The output could e.g. be:
@BlackShroud has been idle for 17hrs 30mins 28secs @Dana has been idle for 14hrs 24mins 9secs @epicaL has been idle for 2days 7hrs 49secs @Microbe has been idle for 6hrs 19mins 45secs
To get longest idle time on channel:
alias idletest { var %i = 1, %idle = 0, %nick while (%i <= $nick(#, 0)) { if ($nick(#, %i).idle > %idle) { %idle = $nick(#, %i).idle %nick = $nick(#, %i) } inc %i } msg $chan %nick has the longest idle time on $chan that is $duration(%idle) }
Returns e.g.: epicaL has the longest idle time on #help.script that is 2days 7hrs 30mins 21secs
Note
The idle property only holds information that your client has seen. If a user has been idle since you've joined that channel the users idle time will be the length you've been in the channel.
Therefore the idle property will not match the idle time a server returns in Raw 317 as that is a clients idle time, not a user on a said channel.
See Also
- Usage of property pnick in tutorial How_do_I_customize_mIRC's_own_output