mIRC Home    About    Download    Register    News    Help

Print Thread
Conditional Statements in Dialog Tables? #267291 10/05/20 03:51 PM
Joined: Jan 2017
Posts: 56
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 56
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.

Re: Conditional Statements in Dialog Tables? [Re: KubosKube] #267292 10/05/20 04:15 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
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.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Conditional Statements in Dialog Tables? [Re: Wims] #267293 10/05/20 09:55 PM
Joined: Jan 2017
Posts: 56
KubosKube Offline OP
Babel fish
OP Offline
Babel fish
Joined: Jan 2017
Posts: 56
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?

Re: Conditional Statements in Dialog Tables? [Re: KubosKube] #267294 10/05/20 10:05 PM
Joined: Jul 2006
Posts: 3,702
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,702
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
}


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net