mIRC Home    About    Download    Register    News    Help

Print Thread
$nick - .random property #223441 24/07/10 04:11 PM
Joined: Jun 2010
Posts: 7
M
Muffinator Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Jun 2010
Posts: 7
$nick currently has the parameters, #,N/nick,qaohvr,qaohvr, and the properties, color, pnick, idle. I think it would be great to have a random property, like such: $nick($chan,*).random, to avoid the far longer code for choosing a random nick, $nick($chan,$rand(1,$nick($chan,0))).

Re: $nick - .random property [Re: Muffinator] #223442 24/07/10 04:53 PM
Joined: Nov 2009
Posts: 81
V
Voglea Offline
Babel fish
Offline
Babel fish
V
Joined: Nov 2009
Posts: 81
$nick(#,$r(1,$nick(#,0)))
long too? smile

Re: $nick - .random property [Re: Voglea] #223443 24/07/10 06:54 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Counting the bytes/characters, yours is up to 8 bytes longer than the suggestion. I know, not much, but some people are that picky.

Re: $nick - .random property [Re: Muffinator] #223445 24/07/10 09:18 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It seems like an arbitrary feature to add. Why not $chan().random, $ial().random, etc.? Basically the same reasoning (shorter code) could be used for any identifier you wanted to use $rand() with, and ultimately, what is the real benefit of saving a dozen or so bytes of code?


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: $nick - .random property [Re: RusselB] #223446 24/07/10 09:31 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Clearly it's longer, but I don't think that was his point. As sbm pointed out, it's completely arbitrary to decide what identifiers deserve to be "shortened by 8 bytes". Functionality, expressiveness, readability and convenience are not calculated solely on an inverse relationship of # bytes.

Practically speaking, I can't imagine $nick(#,*).random would really be used enough to justify that. I know people write random nick popups, but they usually just write a handful-- picking a random nick is not really a core function that everyone needs to perform on a daily basis-- and for the few that actually do, it's scriptable.

From an organizational/cohesion standpoint, a ".random" property has no place in an identifier that's meant to access a nick list. That just makes things really messy. How data in a list based identifier is accessed should not be the concern of the identifier.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"