Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: 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
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Wed Jan 30, 2008 2:30 pm   
 
"#addkey class/var ... " works.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: 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.
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: 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.
Reply with quote
alluran
Adept


Joined: 14 Sep 2005
Posts: 223
Location: Sydney, Australia

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net