mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2017
Posts: 57
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
I did some toying around before posting. I found that a dialog can use $iif to select between different values, and that you can use %global_variables to provide user-created data, but using a regular "if () {}" statement caused the dialog to stop working.

Are there workarounds to this? I've been wanting to work with this stuff for a while, but I just haven't gotten around to it until now, and I think it'd be rather useful.

Joined: Jul 2006
Posts: 4,141
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,141
You cannot include code inside the dialog table, you can call $identifiers and variables though.

You can use the on dialog 'init' event name to set up initial values in your dialog.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2017
Posts: 57
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 57
Okay, so for example, I want a dialog to range in size based on the presence of a remote script or not,

I can put conditional if statements or use $calc to add numbers or whatever, as long as the values are defined inside of the "on *:dialog:dialog_name:init: {}" code?

So then it looks like this:
Code
on *:dialog:dialog_name:init: {
  set %somevariable 10
  if (condition) { set %somevariable $calc(%somevariable + 10) }

dialog dialog_name {
  title "Test"
  size -1 -1 82 %somevariable
  option dbu
}


Does that look right?

Joined: Jul 2006
Posts: 4,141
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,141
What I said was true for anything but the size, although for the size of the dialog, it's possible to put any value in the table and then user /dialog -s to resize the dialog from on on dialog 'init' event.
But controls cannot be resized/moved once they are created (at least not with only mIRC), so you do need to define their value in the table. You can use identifiers call to execute /if statement:


Code
alias mydialogheight {
if ($script(0) > 7) return 100
return 80
}
dialog dialog_name {
  title "Test"
  size -1 -1 82 $mydialogheight
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard