mIRC Homepage

set command depending on dialog box status

Posted By: Dylan666

set command depending on dialog box status - 07/12/08 01:46 PM

What's wrong with this code?

Code:
 on 1:dialog:dialog1:edit:*:{ 
 set %textbox1 $did(1).text 
 if ($did(dialog1,30).state == 0){ /set %var1 $asc($did(40).text) } 
 else { /set %var1 $chr(45) }
} 

Posted By: RusselB

Re: set command depending on dialog box status - 07/12/08 02:14 PM

Nothing that I can see, presuming the following are true:
1) Dialog ID 30 is either a radio button or a check box
2) ID 40 contains a single character.
Posted By: Dylan666

Re: set command depending on dialog box status - 07/12/08 02:46 PM

They are both true
The next part of the code is this:

Code:
 on 1:dialog:dialog1:sclick:100:{ 
 var %i = 1
 while (%i <= $did(1).lines) {
 %line= $did(1,%i).text
 %first = $gettok(%line,$did(50).text,%var1)
 %second= $gettok(%line,$did(60).text,%var1)
 inc %i
 /echo -a state $did(dialog1,30).state
 /echo -a data %var1 
 /echo -a text $asc($did(40).text)
 /echo -a first %first 
 /echo -a second %second
 }
}


Ok, let's try:
I write this in the text box:

Code:
cat.dog.mouse.lion


In the ID 40 i write "." (without "")
I read this:

Code:
state 0
data 46
text 46
first cat
second dog


That's ok

Now I click in the checkbox (ID 30) and I write:
Code:
cat-dog-mouse-lion


I read this:

Code:
state 1
data
text
first
second


Why?
Posted By: RusselB

Re: set command depending on dialog box status - 07/12/08 02:55 PM

I have the feeling that your real problem lies in part of the code that you aren't showing.
If this is true, don't feel bad as it happens to the best of us.

If you would post your full code here, or in a Pastebin and then reference the pastebin here, I should be able to determine if what I suspect is correct, and then be of more assistance.

Please note that I have company coming for the day in a couple of hours, so if you don't get it to me by then, I won't be able to work on it until Monday.
Posted By: Dylan666

Re: set command depending on dialog box status - 07/12/08 03:20 PM

This is the entire script. I have isolated this part in a dedicated test.ini file, so other script should not interfere

Code:
[script]
 menu status,channel,query {
  ..-
  - T E S T I N G -
  .- Command - : /xtest
 }
;########################### 
 alias xtest { dialog -m dialog1 dialog1 }
 dialog dialog1 {
  title "Test dialog"
  size -1 -1 401 161
  option pixels
  text "List", 2, 7 3 49 12
  edit "", 1, 2 17 221 109, multi return autohs autovs hsbar sbar
  button "OK", 100, 91 133 44 20, ok
  check "TAB", 30, 355 18 50 20
  text "Separator", 4, 235 21 57 16
  edit "", 40, 300 18 48 21
  text "First element", 5, 235 55 75 16
  edit "", 50, 340 49 48 21
  text "Second element", 6, 235 89 103 16
  edit "", 60, 340 83 48 21
}
 on 1:dialog:dialog1:sclick:30:{
 if ($did(dialog1,30).state == 1) { /did -m dialog1 40 } 
 else { /did -n dialog1 40 } 
}
 on 1:dialog:dialog1:edit:*:{ 
 if ($did(dialog1,30).state == 0){ /set %var1 asc($did(40).text) }
 else { /set %var1 $chr(45) }
} 
 on 1:dialog:dialog1:sclick:100:{ 
 var %i = 1
 while (%i <= $did(1).lines) {
 %line = $did(1,%i).text
 %first = $gettok(%line,$did(50).text,%var1)
 %second = $gettok(%line,$did(60).text,%var1)
 inc %i
 /echo -a state $did(dialog1,30).state
 /echo -a data %var1 
 /echo -a text $asc($did(40).text)
 /echo -a first %first
 /echo -a second %second
 }
}
Posted By: Dylan666

Re: set command depending on dialog box status - 11/12/08 07:57 AM

Did you see something wrong?
Posted By: DJ_Sol

Re: set command depending on dialog box status - 11/12/08 01:10 PM

if ($did(dialog1,30).state == 0){ /set %var1 $asc($did(40).text) }


No space between comparison and opening bracket. Im surprised you didnt get a bracket mismatch errror. Or do you not check for those?
Posted By: Dylan666

Re: set command depending on dialog box status - 13/12/08 02:12 PM

ok, spaces added
Another error was here:

Code:
else { /set %var1 $chr(45) }



I should have used $asc(-)
© 2019 mIRC Discussion Forums