mIRC Home    About    Download    Register    News    Help

Topic Options
#207125 - 07/12/08 01:46 PM set command depending on dialog box status
Dylan666 Offline
Babel fish

Registered: 09/08/03
Posts: 50
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) }
} 



Edited by Dylan666 (07/12/08 01:48 PM)

Top
#207126 - 07/12/08 02:14 PM Re: set command depending on dialog box status [Re: Dylan666]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top
#207127 - 07/12/08 02:46 PM Re: set command depending on dialog box status [Re: RusselB]
Dylan666 Offline
Babel fish

Registered: 09/08/03
Posts: 50
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?

Top
#207128 - 07/12/08 02:55 PM Re: set command depending on dialog box status [Re: Dylan666]
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top
#207130 - 07/12/08 03:20 PM Re: set command depending on dialog box status [Re: RusselB]
Dylan666 Offline
Babel fish

Registered: 09/08/03
Posts: 50
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
 }
}

Top
#207258 - 11/12/08 07:57 AM Re: set command depending on dialog box status [Re: Dylan666]
Dylan666 Offline
Babel fish

Registered: 09/08/03
Posts: 50
Did you see something wrong?

Top
#207260 - 11/12/08 01:10 PM Re: set command depending on dialog box status [Re: Dylan666]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
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?

Top
#207321 - 13/12/08 02:12 PM Re: set command depending on dialog box status [Re: DJ_Sol]
Dylan666 Offline
Babel fish

Registered: 09/08/03
Posts: 50
ok, spaces added
Another error was here:

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



I should have used $asc(-)


Edited by Dylan666 (13/12/08 02:35 PM)

Top