mIRC Home    About    Download    Register    News    Help

Print Thread
Trouble pulling value from $dialog() #260530 05/05/17 02:49 PM
Joined: Jan 2017
Posts: 57
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
I have this particular dialog...

Code:
dialog example {
  title "Example!!!"
  size -1 -1 62 36
  option dbu
  text "Arbitrary Text!", 1, 2 2 60 8, center
  radio "Continue", 2, 2 10 33 10
  radio "Abort", 3, 35 10 27 10
  button "OK", 4, 2 22 58 12, ok
}


Now here's my problem. I can't get $dialog(example,example) to return any value.
I've tried "//echo -a $dialog()"
And I've tried "set %variable $dialog() | echo -a %variable"
But in both situations, the echo command fails because there is nothing to echo.

What am I doing wrong?

Re: Trouble pulling value from $dialog() [Re: KubosKube] #260531 05/05/17 04:10 PM
Joined: Jan 2004
Posts: 1,656
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,656
From within an ON DIALOG event, you can use $dname instead of the name of the dialog, or can get values by using $did($did). But from outside the $devent, you must use $did(Example,number)

Code:
on *:dialog:Example:init:*: {
;Here's where you set values that can't be done when setting up dialog

did -o example 1 1 This overwrites the text label
}


Code:
on *:dialog:Example:sclick:*: {

echo -s Dialog: $dname Event: $devent $iif($did,DID: $did did(did):  $did($did) state: $did($did).state sel: $did($did).sel $did($did).seltext , Clicked on dialog background outside any "Controls" )

if ($did == 4) {
echo -s You clicked on the $did($did) button
}

if ($did == 2-3) { echo -a Clicked on the radio button named $did(Example,$did)
}

Re: Trouble pulling value from $dialog() [Re: KubosKube] #260532 05/05/17 05:19 PM
Joined: Feb 2015
Posts: 118
kap Offline
Vogon poet
Offline
Vogon poet
Joined: Feb 2015
Posts: 118
Code:
dialog example {
  title "Example!!!"
  size -1 -1 62 36
  option dbu
  text "Arbitrary Text!", 1, 2 2 60 8, center
  radio "Continue", 2, 2 10 33 10
  radio "Abort", 3, 35 10 27 10
  button "OK", 4, 2 22 58 12, ok
  edit "",5, 1 1 1 1, result hide
}
on *:DIALOG:example:init:0:{ did -c $dname 2 | did -o $dname 5 1 Continue }
on *:DIALOG:example:sclick:2:{ did -o $dname 5 1 Continue }
on *:DIALOG:example:sclick:3:{ did -o $dname 5 1 Abort }

alias example { echo -a $dialog(example,example,-4) }

Last edited by kap; 05/05/17 05:20 PM.

GNU Terry Pratchett - Looking for a mIRC help channel -> Check #mircscripting @ irc.swiftirc.net
Re: Trouble pulling value from $dialog() [Re: kap] #260533 05/05/17 08:02 PM
Joined: Jan 2017
Posts: 57
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
Thank you guys! This makes perfect sense!