mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2005
Posts: 4
D
Self-satisified door
OP Offline
Self-satisified door
D
Joined: May 2005
Posts: 4
Hi all, i am kinda new here.. and also new to mirc scripting.. i was trying to create a dialog script but i am having problem..
here's the code:
Code:
/test {
  %result = $dialog(yesno).title
}

dialog yesno {
  title "Are you sure?"
  size -1 -1 144 50
  option dbu
  text "Are you sure you wanna do that?", 1, 31 10 81 6
  button "Yes", 2, 29 27 37 12, ok
  button "No", 3, 75 27 37 12, cancel
}


when i am trying to run the dialog with "/yesno" or "/dialog yesno" i get the error "YESNO Unknown command"
and when i try to run the TEST alias, it creates the var %result, but gives it nothing.. =/

will u guys please help me with that one?

ty all and have a nice day!

Joined: Mar 2004
Posts: 155
D
Vogon poet
Offline
Vogon poet
D
Joined: Mar 2004
Posts: 155
To open the dialog it's /dialog -m yesno yesno I'm not quite sure what you are going for with the /test thing unless your trying that as an alias which I believe should be
Code:
alias test {
%result = $dialog(yesno).title
}


Don't hold me to that.
If you are looking to open the dialog with an alias (shortcut) it would be this...
Code:
alias yesno { dialog -m yesno yesno }

Last edited by Darkmnm; 06/05/05 09:05 AM.
Joined: May 2005
Posts: 4
D
Self-satisified door
OP Offline
Self-satisified door
D
Joined: May 2005
Posts: 4
well, when i was trying to type "/dialog -m yesno yesno" i still got an error

and btw.. the TEST thing should get the value from the pop-up and put it in %result...

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Try this in Remote Scripts (Alt + R)..

Code:
alias test {
  if ($dialog(yesno)) %result = $dialog(yesno).title
}

dialog yesno {
  title "Are you sure?"
  size -1 -1 144 50
  option dbu
  text "Are you sure you wanna do that?", 1, 31 10 81 6
  button "Yes", 2, 29 27 37 12, ok
  button "No", 3, 75 27 37 12, cancel
}


It could be that your script has a /dialog alias already.

Type //echo -a $isalias(dialog) if it returns $true type /alias /dialog.

If it returns true you can run the dialog without typing the above by prefixing the command with a !

/!dialog -m yesno yesno

Notes to consider:

[*]When adding aliases in Remote Scripts (Alt + R) we use alias {alias name} { commands }
[*]When adding aliases in the Aliases section (Alt + A) we don't put alias in. We put {alias name} { commands }

All the best,

-Andy

Joined: May 2005
Posts: 4
D
Self-satisified door
OP Offline
Self-satisified door
D
Joined: May 2005
Posts: 4
wow now i am really confused :P
first of all tnx for the detailed reply..
second.. ill just tell u want i am trying to do and see if u can help me..

so.. i got a menu which when i press on it i want it to show a warning message like shown above in my script..
so here's the menu (it's on the remote script btw)
Code:
Menu Channel,NickList,MenuBar {
  Master: { if (***) { /continue } }
  }

insted of the *** i should put a reference to the dialog..
ok.. so here's my dialog:
Code:
dialog yesno {
  title "Are you sure?"
  size -1 -1 144 50
  option dbu
  text "Are you sure you wanna do that?", 1, 31 10 81 6
  button "Yes", 2, 29 27 37 12, ok
  button "No", 3, 75 27 37 12, cancel
}


so where's should i put the dialog.. and what should i put in the IF command..

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Well, the for the menu you thing you wont need to use dialogs..

Code:
menu channel,nicklist,menubar {
  Master: $iif($input(Are you sure you wanna do that? $str($chr(160),40) ,y,Are you sure?),echo -a Continue...,echo -a Don't continue...)
}


Type //echo -a $iif($input(Are you sure you wanna do that? $str($chr(160),40) ,y,Are you sure?),echo -a Continue...,echo -a Don't continue...)

To see what it looks like.

-Andy

Joined: May 2005
Posts: 4
D
Self-satisified door
OP Offline
Self-satisified door
D
Joined: May 2005
Posts: 4
rofl! it's that simple!? and it works! laugh
ty dude!!

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Your way (using dialogs)..

Code:
menu menubar {
  Master:dialog -am yesno yesno
}

dialog yesno { 
  title "Are you sure?" 
  size -1 -1 144 50 
  option dbu  
  text "Are you sure you wanna do that?", 1, 31 10 81 6  
  button "Yes", 2, 29 27 37 12
  button "No", 3, 75 27 37 12
}

On *:Dialog:yesno:*:*: {
  if ($devent == sclick) {
    if ($did == 2) echo -a Continue...
    if ($did == 3) echo -a Don't continue...
  }
  if ($devent == close) {
    echo -a Dialog closed...
  }
  if ($devent == init) {
    echo -a Dialog opened...
  }
}


Since you said you're a new scripter, I just thought I'd add some more informations on dialogs. init is the Dialog event which the dialog opens. Sclick is when a dialog control (edit, radio, combo...) has been single clicked. Closed as you can see above triggers when the dialog itself has been closed. The above Dialog events can also look like..

Code:
menu menubar {
  Master:dialog -am yesno yesno
}

dialog yesno { 
  title "Are you sure?" 
  size -1 -1 144 50 
  option dbu  
  text "Are you sure you wanna do that?", 1, 31 10 81 6  
  button "Yes", 2, 29 27 37 12
  button "No", 3, 75 27 37 12
}

On *:Dialog:yesno:init:*: {
  echo -a Dialog opened...
}

on *:Dialog:yesno:sclick:2: {
  echo -a Continue...
}

on *:Dialog:yesno:sclick:3: {
  echo -a Don't continue...
}

on *:Dialog:yesno:close:*: {
  echo -a Dialog closed...
}


You may already know all of this (but I hope you don't because hopefully you can learn something new hehe).

All the best,

-Andy.


Link Copied to Clipboard