|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: Wed Jan 30, 2008 1:56 pm
Addkey Updgrade Request |
Can we get a way to specify the class of the variable when we use #addkey, just like we do with #var?
eg #addkey requestlist {addkey} {add class specification} {CMUD} |
|
_________________ The Drake Forestseer |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Wed Jan 30, 2008 2:30 pm |
"#addkey class/var ... " works.
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Wed Jan 30, 2008 7:01 pm |
Typically, you'd just use #VAR to make the variable in the class folder and THEN do the #ADDKEY. If you're not sure whether or not the variable exists, you can check. As Zhiroc pointed out, you can specifically reference the variable where you want it, too, which would be especially handy if you wanted to ensure that the same data is updated and referenced throughout your scripts.
|
|
|
|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: Wed Jan 30, 2008 10:48 pm |
Ya, there's work arounds, but they're not as elegant as the solution proposed above :D
Just like alot of things in zMud that have been improved upon in cMud ;) |
|
_________________ The Drake Forestseer |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 30, 2008 11:55 pm |
I don't plan to add an additional class argument to #addkey. The correct solution is as Zhiroc mentioned to use the //module/class/varname syntax. This is the more modern syntax supported by CMUD. The class name argument to #VAR is just left over from zMUD compatibility.
|
|
|
|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: Wed Jan 30, 2008 11:59 pm |
the //module/class/varname doesnt generate the classes if they dont exist though do they? unlike the old #var syntax?
Funily enough, i used to use this syntax but it wasn't supported everywhere so i changed (in zmud), is it more supported in cmud now? |
|
_________________ The Drake Forestseer |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jan 31, 2008 5:39 pm |
No, it won't create a class. You should create the variable with #VAR if it doesn't exist yet. Or use #CLASS to create a class. The syntax should be supported anywhere in CMUD, so if you find a command it doesn't work with, then post a bug report for it. zMUD was completely different and didn't support this syntax in most places.
|
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Thu Jan 31, 2008 11:39 pm |
Hmm, if in a blank session I do "#addkey /class/var x y", it creates class "class". It won't make a module, though.
|
|
|
|
alluran Adept
Joined: 14 Sep 2005 Posts: 223 Location: Sydney, Australia
|
Posted: Thu Jan 31, 2008 11:55 pm |
Another point, haven't tested in cmud yet, but i know in zmud, #addkey was about 10-50 times faster (i forget the exact figure, atreidess did the testing) than #var, It's probably the biggest reason i try to avoid #var these days, though, with cmud, things should be faster anyways, but that's no excuse for sloppy code!
|
|
_________________ The Drake Forestseer |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Feb 01, 2008 3:29 am |
CMUD and zMUD are completely different programs internally so just because it was faster or slower in zMUD doesn't necessarily carry over to CMUD. You'll need to test in CMUD to be sure. In general, I find it to be better coding "style" to create/declare the variables using #VAR and then use #ADDKEY. But if #ADDKEY already creates a class, then go for it because I don't plan to change it so that it doesn't.
CMUD might eventually also create modules...it's something that has been debated. But for now you need to use #MODULE to create a module, just like you need to use #WINDOW to create a window. |
|
|
|
|
|