mIRC Home    About    Download    Register    News    Help

Print Thread
#170622 11/02/07 08:21 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
i have issue with combo box which get me a bit frustrated...

in short i have this in INIT:

Code:

on *:dialog:name:init:0:{
  did -a $dname 25 [0] *!user@host.domain
  did -a $dname 25 [1] *!*user@host.domain
  did -a $dname 25 [2] *!*@host.domain
  did -a $dname 25 [3] *!*user@*.domain
  did -a $dname 25 [4] *!*@*.domain
  did -a $dname 25 [5] nick!user@host.domain
  did -a $dname 25 [6] nick!*user@host.domain
  did -a $dname 25 [7] nick!*@host.domain
  did -a $dname 25 [8] nick!*user@*.domain
  did -a $dname 25 [9] nick!*@*.domain
  if (!%host.type) { set %host.type 2 | did -c $dname 25 %host.type }
  elseif (%host.type == 0) { did -c $dname 25 1 }
...
...


and this in SCLICK

Code:
if ($did = 25) { set %host.type $gettok($remove($did(25),[,]),1,32) }



PROBLEM
is that even if i CLICK on host type 0 on combo control (combo value 1)
it will always next time on INIT put it on host type 1 (combo value 2)

and as seen on end of INIT even code, my "chekcup" doesnt work...
and if i set anything else (than host type 0) value in combo dissaperas :P

so what should i do?



IceCapped
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
For your init, why not just use:

did -c $dname 25 $calc(%host.type + 1)

That will save a lot of elseif stuff.

The end of your init will look like this:

Code:
  if (!%host.type) { set %host.type 2 | did -c $dname 25 %host.type }
  else { did -c $dname 25 $calc(%host.type + 1) }


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
because when i run dialog it always gives +1 +1
so if i last time set hos type to 0, next time i run dialog it
will be set on host type 1, if i set last time host type on 5,
next time i run dialog it will be set on 6...

and i would like dialog to REMEMBER last taken host type
but for reasons that host type 0 is item 1 on combo control
its all fucked up :P


IceCapped
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
set %host.type $did(25).sel


or

Code:
set %host.type $calc($did(25).sel - 1)


Pick from those based on whether or not you want the line number stored or the actual host type stored (the second one will store the host type instead of the line number). If you use the second one, then use the +1 calculation I showed you above for selecting the correct line.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
this is ok, thanks.
just to ask why doesnt mirc do this correct.

for example what ever value i chose (1-10)
for //echo -a $address($me,(%host.type - 1))

i always get only result for host type 0

why?


IceCapped
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You need to use $calc if you're doing any calculations (such as %host.type - 1).


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
well i tried

//echo -a $address($me,($calc(%host.type - 1)))

and

//echo -a $address($me,$calc(%host.type - 1))

for both i get * /echo: insufficient parameters

:P


IceCapped
Joined: Jul 2006
Posts: 107
L
Vogon poet
Offline
Vogon poet
L
Joined: Jul 2006
Posts: 107
For that echo to work from the command line, you have to evaluate the $calc part.

Code:
//echo -a $address($me,$($calc(%host.type - 1),2))


It may work in a script without the separate evaluation. I can never keep that straight.

Also, you'd have to be online. From the help file:

Quote:
If the Internal Address List doesn't contain a matching nickname, the identifier returns $null.




LonDart
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
aww nice, that works.
just to ask why is number 2 in the end of this "code" ?

),2))

Last edited by raZOR; 13/02/07 04:36 AM.

IceCapped
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
it's all still under $address, so it's $address(......,2) which shows in *!*@ADDRESS.COM


-Kurdish_Assass1n
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
no it doesnt
i tested it with different host types and it returns correct ones


IceCapped
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The ,2 is part of the $() and causes a double evaluation.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: LonDart
For that echo to work from the command line, you have to evaluate the $calc part.


You don't. Reasons why $address may return $null is that you're not connected or not on a channel, but you certainly don't need to use $() here.


Link Copied to Clipboard