mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
   if $did == 1002 {
    did -c $dname 2002,302 $did($did).sel
  }
  elseif $did == 2002 {
    did -c $dname 1002,302 $did($did).sel
  }
  else did -c $dname 1002,2002 $did($did).sel
 

That works, but I've got the feeling that I'm missing an easier way of coding that. Basically the 3 ID's have the same information in them, and no matter which one is clicked, the other two have to match it.

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Use 2 $iif's maybe

Code:
 did -c $dname $iif($did == 1002,$+(2002,$chr(44),302),$iif($did ==2002, $+(1002,$chr(44),302),$+(1002,$chr(44),2002))) $did($did).sel 


Kinda messy though. I would probably stick with the first code.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: Jan 2006
Posts: 468
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2006
Posts: 468
Personally I think that your style is the best way of coding it, as it looks clean and pretty readable. That is the way the code should look like

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You could also do this:
Code:
  var %ids = 1002,2002,302
  if $istok(%ids,$did,44) {
    did -c $dname $remtok(%ids,$did,44) $did($did).sel
  }


If this is in a sclick event that fires when a listbox line is selected, you can even omit $remtok() and do a /did -c for all 3 IDs: attempting to select an already selected line simply does nothing.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard