mIRC Homepage
Posted By: NaquadaServ Constants without identifers - 23/12/06 04:48 PM
Instead of
Code:
alias dialog_id_description { return 23 }
on *:dialog:dname:sclick:23:{
 did -ra $dname $dialog_id_description Test
}

Using a constant
Code:
constant dialog_id_description 23
on *:dialog:dname:sclick:'dialog_id_description:{
  did -ra $dname 'dialog_id_description Test
}


Additionally, Constants can only be single line, can only be defined outside of an alias, and would be usable anywhere; dialog tables, event definitions, etc... They would be different than global variables because they can not be modified from the command line. I'm also open to suggestions on using some other special character rather than a single quote.

This feature can make scripts more readable and easier to debug. smile
Posted By: cold Re: Constants without identifers - 23/12/06 10:31 PM
Even though I've read your reasons, I still can't see the difference. Constants have their unique place in compiling languages, but where's their unique place (i.e., somewhere aliases can't go) in mIRC - a non-compiling language? Other than being "more readable and easier to debug" (IMHO, following your example, they're not; this is subjective), what's there about them?

Could you elaborate, please?
Posted By: starbucks_mafia Re: Constants without identifers - 23/12/06 11:17 PM
In addition to cold's post, adding another sigil to the language (the ' ) is going to cause compatability issues of literal strings becoming non-existent constants. Instead they'd probably have to use some variation of existing syntax - leaving us with aliases in all but name.
Posted By: NaquadaServ Re: Constants without identifers - 24/12/06 03:57 AM
There are limitations that I want to get around as well, such as these problem...
Code:
; set's can't appear outside an alias, if it could, it would be acting
; like a constant
set %x 255

; The sclick event is never processed because identifers can't be used
; in event definitions. $id1 is valid in the dialog definition.
alias dotest { dialog -m Test Test }
alias id1 { return 1 }
dialog Test {
  title "Test"
  size -1 -1 50 50
  option dbu
  button "ClickMe", $id1, 5 5 40 40
}
on *:dialog:Test:sclick:$id1:{ did -ra $dname $did NeverSeeThis }
Posted By: NaquadaServ Re: Text label replacing DID for dialogs - 24/12/06 07:47 AM
For those who oppose this idea, perhaps a better solution would be to allow a text label to optionally replace DID's in dialogs. Naming dialog id's would be my primary reason for wanting this.

Code:
dialog Test {
  title "Test"
  size -1 -1 50 50
  option dbu
  button "ClickMe", btnClickMe, 5 5 40 40
}
on *:dialog:Test:sclick:btnClickMe:{ did -ra $dname $did Solution! }
Posted By: Om3n Re: Text label replacing DID for dialogs - 24/12/06 11:54 AM
I like the idea of allowing text labled dialog items in addition to the id's. And in addition to ability to use $() style matchtext in the dialog's id field would be handy (and even regex, though im not sure if thats possible already or not).

I think that method would be much more useful and consistant with mirc scripting than adding 'constants' etc. Should also make it much easier to generate somewhat more dynamic dialogs and dialog events.
Posted By: Riamus2 Re: Text label replacing DID for dialogs - 25/12/06 04:16 AM
I agree. I don't see a need for constants, but I like the idea of named dialog IDs.
Posted By: cold Re: Text label replacing DID for dialogs - 25/12/06 05:44 AM
Originally Posted By: NaquadaServ
For those who oppose this idea, perhaps a better solution would be to allow a text label to optionally replace DID's in dialogs. Naming dialog id's would be my primary reason for wanting this.


Now that's a good idea. I support that. grin
Posted By: CakerX Re: Constants without identifers - 02/01/07 06:30 PM
you can put sets in your on *:load command....

I never saw the need to constants,

named dialog controls, hell yeah. makes the script easier to read
© mIRC Discussion Forums