|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
alias slap_manager_cb {
if $2 == sclick {
if $3 == 6 {
xdid -t $1 6 Slap $iif($xdid($1,6).state,Checked,All)
}
elseif $3 == 1 {
.scon $4
echo -a $1-
[color:red] if !$5 {
var %a = 1, %b = $chan(0)
while %a <= %b {
xdid -a $1 1 $+($4 %a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%a),$chr(9),)
inc %a
}
}
else {
var %path = $xdid($1,1).selpath
var %chan = $xdid($1,1,%path)
echo 4 -a %path %chan
} [/color]
}
}
elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
echo $color(info) -s */ slap_manager_cb: $1-
}
} The above code works fine, when $5 (as marked in red) is null, however, for some reason, that same section of code also runs when $5 isn't null. While some of the commands that are done are DCX based (and I know this isn't the DCX forum), I don't think that the problem lies with those commands, as it's the if/else combination regarding $5 that seems to be failing. When run (with the full code), and $5 returning $null, $1- returns slap_manager sclick 1 1 When $5 isn't $null, then $1- returns slap_manager sclick 1 1 1 This is really confusing to me, since it appears to be running the same code, whether $5 is null or not.
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
Can you provide an example of how you call this command? Both when it works and when it doesn't work as expected.
-genius_at_work
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
The command is called by clicking in a DCX treeview list. The list initiates as a list of network connections, then when a network is selected, the list of channels that you're on is generated under that network name, generating a tree style listing. To that point, it works correctly, however, when a channel is clicked in the treeview, then it's generating a second (third, fourth, fifth, etc.) list of channels as branches off of the channel that was selected. I was hesitant about posting the script, as the dialog is DCX based and this isn't the DCX forum, but if it would help, and I won't get into trouble for posting it, then I will do so.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
The command is called by clicking in a DCX treeview list. The list initiates as a list of network connections, then when a network is selected, the list of channels that you're on is generated under that network name, generating a tree style listing. To that point, it works correctly, however, when a channel is clicked in the treeview, then it's generating a second (third, fourth, fifth, etc.) list of channels as branches off of the channel that was selected. I was hesitant about posting the script, as the dialog is DCX based and this isn't the DCX forum, but if it would help, and I won't get into trouble for posting it, then I will do so. Don't delete your old code just incase but try this...
alias slap_manager_cb {
if $2 == sclick {
if $3 == 6 {
xdid -t $1 6 Slap $iif($xdid($1,6).state,Checked,All)
}
elseif $3 == 1 {
.scon $4
echo -a $1-
if ($5) {
var %path = $xdid($1,1).selpath
var %chan = $xdid($1,1,%path)
echo 4 -a %path %chan
}
elseif (!$5) {
var %a = 1, %b = $chan(0)
while %a <= %b {
xdid -a $1 1 $+($4 %a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%a),$chr(9),)
inc %a
}
}
}
}
elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
echo $color(info) -s */ slap_manager_cb: $1-
}
}
reversing the $null eval im not sure if it will work or not just try it please let me know
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
No difference, thanks for trying.
|
|
|
|
Joined: Mar 2004
Posts: 208
Fjord artisan
|
Fjord artisan
Joined: Mar 2004
Posts: 208 |
( $5 == $null ) is the same as ( $5 == 0 ) - write a test script and try it. Test
if %test { }
for %test equal to $null, 0 and 1. You'll get the same result if it's $null or 0 - they're both false. 1 (or any non-zero, non-$null value) is true.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Unfortunately, I tried that before posting on the forum. I just made a couple of small changes to the code from Lpfix5, so that it reads alias slap_manager_cb {
if $2 == sclick {
if $3 == 6 {
xdid -t $1 6 Slap $iif($xdid($1,6).state,Checked,All)
}
elseif $3 == 1 {
.scon $4
if ($5) {
; var %path = $xdid($1,1).selpath
; var %chan = $xdid($1,1,%path)
; echo 4 -a %path %chan
echo 4 -a $5
}
elseif (!$5) {
var %a = 1, %b = $chan(0)
echo -a $numtok($1-,32) $1-
while %a <= %b {
xdid -a $1 1 $+($4 %a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%a),$chr(9),)
inc %a
}
}
}
}
elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
echo $color(info) -s */ slap_manager_cb: $1-
}
}
Then tested it 4 times, with the following being the echoed results 4 slap_manager sclick 1 1 5 slap_manager sclick 1 1 1 6 slap_manager sclick 1 1 1 1 7 slap_manager sclick 1 1 1 1 1
|
|
|
|
DaveC
|
DaveC
|
I copied your code verbatiem adding only lines needed to check which path the script took, However I couldnt reproduce the problem (mirc v6.2)alias slap_manager_cb {
if $2 == sclick {
if $3 == 6 {
xdid -t $1 6 Slap $iif($xdid($1,6).state,Checked,All)
}
elseif $3 == 1 {
.scon $4
echo -a $1-
if !$5 {
///echo -a " if !$5 $true " | halt
var %a = 1, %b = $chan(0)
while %a <= %b {
xdid -a $1 1 $+($4 %a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%a),$chr(9),)
inc %a
}
}
else {
///echo -a " if !$5 $false " | halt
var %path = $xdid($1,1).selpath
var %chan = $xdid($1,1,%path)
echo 4 -a %path %chan
}
}
}
elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
echo $color(info) -s */ slap_manager_cb: $1-
}
} //slap_manager_cb slap_manager sclick 1 1 slap_manager sclick 1 1 " if !$5 $true " //slap_manager_cb slap_manager sclick 1 1 1 slap_manager sclick 1 1 1 " if !$5 $false " //noop $slap_manager_cb(slap_manager,sclick,1,1) slap_manager sclick 1 1 " if !$5 $true " //noop $slap_manager_cb(slap_manager,sclick,1,1,1) slap_manager sclick 1 1 1 " if !$5 $false " all above were as expected, nb: $5 being 0 or $null well result in a $true as im sure you know already, but below might be what your experencing, although it doesnt match to your problem with $5 being "1"//echo $slap_manager_cb(slap_manager,sclick,1,1,$chr(32)) slap_manager sclick 1 1 " if !$5 $false "
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
OK...I finally figured out what is wrong. $5 keeps being $null at all times, but $4 changes to include a space separated list of numbers So the first time the code is run, $4 returns 1 The second time, $4 returns 1 1 the third time, 1 1 1 4th time, 1 1 1 1 etc. the number of space delimited tokens keeps increasing, but there's still only 4 items being returned. The 4th item just keeps returning more space delimited tokens.
Thanks to all who helped. Looks like my best method to resolve this problem is to use the tokenize command.
|
|
|
|
DaveC
|
DaveC
|
I had a feeling it might be to do with the alias being called as an identifier, as if its a alias its called as u never get that problem. Glad ya fixed it, and year a simple TOKENIZE 32 $1- and ya there!
|
|
|
|
|