mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
I have been playing around with creating a dialog box with buttons...

This is what I have done...


Code:
Dialog support { 
  title "Support" 
  size -1 -1 300 100 
  button "Start",1, 1 5 120 25
  button "Verify",2, 1 35 120 25
  button "Test",3, 1 65 120 25
  button "Cancel",6, 130 65 100 25, cancel
}
on *:dialog:support:sclick:1:{
  say Hello! What can I help you with?
}
on *:dialog:support:sclick:2:{
  say Could you please verify the the username and email address of your account for security purposes?
}
on *:dialog:support:sclick:3:{
  echo -a Test Successful!
  /dialog -x support
}



Buttons 3 and 4 work, but 1 and 2 do nothing... I sent the code to a friend of mine and he says that all of the buttons work for him, but I cannot get them to work for me.

I am using mIRC in wine on linux and thought maybe that was somehow affecting it, so I installed Windows XP on a VM and tried it and it still would not work.

Any ideas? Thanks in advance.

Last edited by jrchevy2005; 14/01/14 09:01 AM.
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You could try somthing like this instead.

Code:
alias support { if (!$dialog(support)) { dialog -m support support } }

dialog support {
  title "Support"
  size -1 -1 300 100
  button "Start",1, 1 5 120 25
  button "Verify",2, 1 35 120 25
  button "Test",3, 1 65 120 25
  button "Cancel",6, 130 65 100 25, cancel
}

on *:dialog:support:*:*: {
  if ($devent == init) {
    echo -st This will show up when you create the dialog.
  }
  if ($devent == sclick) {
    if ($did == 1) { echo -st Hello! What can I help you with? }
    elseif ($did == 2) { echo -st Could you please verify the the username and email address of your account for security purposes }
    elseif ($did == 3) { echo -st Test Successful! | dialog -x $dname }
  }
}

Untested, but i think it should work.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: sparta
You could try somthing like this instead.

Code:
alias support { if (!$dialog(support)) { dialog -m support support } }

dialog support {
  title "Support"
  size -1 -1 300 100
  button "Start",1, 1 5 120 25
  button "Verify",2, 1 35 120 25
  button "Test",3, 1 65 120 25
  button "Cancel",6, 130 65 100 25, cancel
}

on *:dialog:support:*:*: {
  if ($devent == init) {
    echo -st This will show up when you create the dialog.
  }
  if ($devent == sclick) {
    if ($did == 1) { echo -st Hello! What can I help you with? }
    elseif ($did == 2) { echo -st Could you please verify the the username and email address of your account for security purposes }
    elseif ($did == 3) { echo -st Test Successful! }
  }
}

Untested, but i think it should work.


Thanks, but nothing happens when I click the buttons with that either.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
They working here, and i using the same code as you got from me. Did you try with the "echo" part? Cos you have

say Hello! What can I help you with?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Thanks for the post. I copied exactly what you posted and it wouldn't do anything. I do not know what is causing them to not work for me, when they seem to work for other people.

As I said, the third button worked in the code I posted. Where it was 'echo -a Test Successful'. It doesn't make sense to me that that one will work, but 'say' will not work.

Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
It works when I try it on my wife's laptop as well. Anyone have any ideas as to why i wouldn't work on mine? I have even tried reinstalling and using just my script on a fresh installation of mIRC with no luck.

Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
um ... stupid question ... are you looking in the status window to see if the echo's are there?


I refuse to engage in a battle of wits with an unarmed person. wink
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: CtrlAltDel
um ... stupid question ... are you looking in the status window to see if the echo's are there?


Ok... sorry, no I wasn't. They do show up in there with that script... but this isn't what I need. I need it to 'say' the command in a channel.

Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
When I try to use 'say' in the script I get '* You are not on a channel' in the status window. But I am activating the script in a channel.

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55

I cant do any testing as when I placed your code into my mIRC I cant seem to get it to do anything or show any dialog box and I need to go out in a moment so as not really not knowing whats going on ....

Try to change the "say" to msg $chan (if its only one channel you want it putting into try msg #channel name)


Regards

JayStew
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Always look in the help file.
Originally Posted By: /help /say
Note: You cannot use /say in the remote section. Use /msg #channel <message> instead


That's for the /say problem, the rest should have worked.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: Wims
Always look in the help file.
Originally Posted By: /help /say
Note: You cannot use /say in the remote section. Use /msg #channel <message> instead


That's for the /say problem, the rest should have worked.

That is really weird. There are several scripts in my remote section that use /say and they all work fine. And my script works for my friend... nevertheless, msg #channel works, but I need it to work in more than one channel.

and 'msg $chan Hello! What can I help you with?' gives me:
Quote:

*Hello!* What can I help you with?
-
Hello! No such nick/channel

in the status area. It seems to ignore identifiers. Neither $chan or $1 work.

Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
It seems that all of the commands are being sent to the status window instead of the channel that I am using the dialog on. Is there a way to fix this?

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Put the channel in a %variable when the dialog is created?

/command | set %test.chan $chan

And make shure you only open the dialog in a channel window.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Thank you again...

That doesn't seem to do anything. I'm sorry, I am new to this. It is driving me crazy that it works for my friend and not for me... with the same exact code. For some reason whatever I put goes to the status window and returns 'you are not on a channel' instead of going into the channel where I started the dialog.

Using $chan doesn't work (because it thinks I am messaging the status window?) For instance... 'msg $chan Hello there' returns 'Hello No such nick/channel'

And I am opening the dialog from inside a channel by typing '/dialog -m support support'
I thought that by opening it in the channel it would send the commands to the channel.

After I sent my friend the code he was able to open the dialog... then clicking the buttons that linked to the 'say' commands caused it to 'say' whatever it was in the channel... he could even move to a different channel with the dialog open and 'say' it there. All with the same code that won't work for me.

Last edited by jrchevy2005; 14/01/14 11:38 PM.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
No it doesn't work for your friend either, if it does, they are not executing the same code, for example, it's possible to override the /say command, to make it use /msg, which might be why it worked for your friend.
Keep in mind the mIRC help file is ALWAYS succints, it always lacks explanations, to the point where it hides features, and that's true once again here: you can use /say inside aliases, not inside events.

Indeed $chan is empty, you can use $active to get the active window, opening a dialog from a channel or from anywhere else makes no difference.

To make sure your friend are, or are not, overriding the /say command, they can check //echo -a $isalias(say), which will be true if they are. /help $isalias for more informations.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: Wims
No it doesn't work for your friend either, if it does, they are not executing the same code, for example, it's possible to override the /say command, to make it use /msg, which might be why it worked for your friend.
Keep in mind the mIRC help file is ALWAYS succints, it always lacks explanations, to the point where it hides features, and that's true once again here: you can use /say inside aliases, not inside events.

Indeed $chan is empty, you can use $active to get the active window, opening a dialog from a channel or from anywhere else makes no difference.

To make sure your friend are, or are not, overriding the /say command, they can check //echo -a $isalias(say), which will be true if they are. /help $isalias for more informations.


Thank you so much for the explanation!
I do not know what my friend has in his scripts besides mine, I just meant that he added mine to his and it worked... Your explanation made it make sense...

Using $active did exactly what I wanted. Thank you!

Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
borrowing from sparta:
Code:
alias support { if (!$dialog(support)) { dialog -m support support } }

dialog support {
  title "Support"
  size -1 -1 300 100
  button "Start",1, 1 5 120 25
  button "Verify",2, 1 35 120 25
  button "Test",3, 1 65 120 25
  button "Cancel",6, 130 65 100 25, cancel
}

on *:dialog:support:*:*: {
  if ($devent == init) {
    echo -st This will show up when you create the dialog.
  }
  if ($devent == sclick) {
    if ($did == 1) { msg $active Hello! What can I help you with? }
    elseif ($did == 2) { msg $active Could you please verify the the username and email address of your account for security purposes }
    elseif ($did == 3) { echo -a Test Successful! | dialog -x $dname }
  }
}


I refuse to engage in a battle of wits with an unarmed person. wink
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You should also read about dialogs. Many things you can do with them. /help $dialog
Code:
on *:dialog:support:*:*: {
  if ($devent == init) {
   echo -st This trigger when dialog is created.
  }
  if ($devent == sclick) {
   echo -st This will trigger when you single click on a ID.
  }
   if ($devent == dclick) {
    echo -st This will trigger when you double click on a ID.
  }
  if ($devent == exit) {
  echo -st This will trigger when the dialog is closed.
 }
}

And more functions to use in the help file.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard