mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
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

Last edited by NaquadaServ; 23/12/06 04:50 PM.

NaquadaBomb
www.mirc-dll.com
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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?


* cold edits his posts 24/7
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
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 }

Last edited by NaquadaServ; 24/12/06 04:04 AM.

NaquadaBomb
www.mirc-dll.com
Joined: Dec 2002
Posts: 580
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
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! }

Last edited by NaquadaServ; 24/12/06 07:54 AM.

NaquadaBomb
www.mirc-dll.com
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
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.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I agree. I don't see a need for constants, but I like the idea of named dialog IDs.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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


* cold edits his posts 24/7
Joined: Oct 2004
Posts: 14
C
Pikka bird
Offline
Pikka bird
C
Joined: Oct 2004
Posts: 14
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


Link Copied to Clipboard