mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
if there is

on 1:dialog:name:init:0: {
if ($did(name,50) != $null) { did -o name 1 text }
}

if there is no dialog ID 50 (it doesn't exist, hasn't been made), it still seems to try and carry out the /did command?

Last edited by quartz; 10/08/20 11:52 AM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Does your error message show $did or /did ? There's a difference.
The $did error comes from evaluating the if() portion, and would also happen if the dialog were already open and tried to do

//echo -a $did(name,50)

while identifier warning was enabled in scripts-editor/options. If you need to quickly check whether you've used a number already:
//echo -a $did(name,50).isid

Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
edit ---- .isid is the trick. that returns $false

-----------------------------

nah it..er...doesn't seem to

this is actually the line
variables are:

%dialog_id [ $+ [ %loop $+ _3 ] ]
%dialog_id [ $+ [ %loop $+ _4 ] ]
%dialog_id [ $+ [ %loop $+ _5 ] ]
%dialog_id [ $+ [ %loop $+ _6 ] ]

which can be

%dialog_id2_3 1073
%dialog_id2_4 1074
%dialog_id2_5 1075
%dialog_id2_6 1076

%loop goes up to about 15

part of the "init" :

on 1:dialog:name:init:0: {
if $did(name, %dialog_id [ $+ [ %loop $+ _3 ] ] ) != $null { did -o name %dialog_id [ $+ [ %loop $+ _3 ] ] 1 %dialog_id [ $+ [ %loop $+ _3 ] ] }
}

so it's filling out the text field of dialog ID 1073, with the number 1073

its basically a table of text fields (about 8 rows by 15 columns so far). it fills out every text entry with the ID of that text entry (so thats 8 x 15 = quite a lot)

completely works when the ID exists, but if the ID doesn't exist (is $null), none of the rest of the "init" happens

I cooooould do a check to say "only /did under certain conditions", but it would be nice if it could only do it if it isn't "$null"

Last edited by quartz; 10/08/20 07:09 PM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
By the way you keep saying that the result of a non-existent dialog control is $null, it indicates you haven't enabled the identifier warning option I mentioned in the post above.

//echo -a result: $did(no-such-dialog,999)

If identifier warning is not checked, then yes the result is $null, the same as doing: //echo -a result: $no_such_identifier

However, after identifier warning is enabled, you'll instead see an error message in the status window which halts your script's execution.
Then, you would use the .isid property to check if it exists before trying to use it as a parameter.

if ($did(name, %dialog_id [ $+ [ %loop $+ _3 ] ] ).isid) { did -o name %dialog_id [ $+ [ %loop $+ _3 ] ] 1 %dialog_id [ $+ [ %loop $+ _3 ] ] }

Edit: the error is "* Invalid parameters: $did" not identifier warning, so checking if the dialog-control exists using the .isid avoids that error.

Last edited by maroon; 11/08/20 01:50 PM.

Link Copied to Clipboard