mIRC Home    About    Download    Register    News    Help

Print Thread
#170622 11/02/07 08:21 PM
Joined: Apr 2005
Posts: 1,008
R
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Apr 2005
Posts: 1,008
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?


Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
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) }

Joined: Apr 2005
Posts: 1,008
R
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Apr 2005
Posts: 1,008
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

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
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.

Joined: Apr 2005
Posts: 1,008
R
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Apr 2005
Posts: 1,008
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?

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

Joined: Apr 2005
Posts: 1,008
R
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Apr 2005
Posts: 1,008
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

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.



Joined: Apr 2005
Posts: 1,008
R
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Apr 2005
Posts: 1,008
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.
Joined: Apr 2006
Posts: 399
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 399
it's all still under $address, so it's $address(......,2) which shows in *!*@ADDRESS.COM

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

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

Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
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