|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Wed Jul 19, 2006 5:30 pm
[1.03] #ADDITEM and data record variables |
I have a nifty little alias that keeps track of my data record keys by using a special key that is a string list of all the other keys. I can't seem to figure a way to make this work in CMUD, however, so I'm asking for advice here. Is this a CMUD bug? Or a new feature and I need to find a new way to do this?
Code: |
#ALIAS i_add {#priority {#if (%null(%3)) {#forall {%2} {#additem %1.keys {%i}};#addkey %1 {%2} 1} {#forall {%2} {#additem %1.keys {%i}};#addkey %1 {%2} {%-3}}}} |
This alias lets me build my data record variables with fewer alias calls and the value for each key is an optional third parameter. Here's a couple examples of how I might use it:
Code: |
i_add afflictions prone|paralysis|stunned
i_add defenses parrying head |
The #forall and #addkey work as expected in CMUD, so my only real issue here is now to built the list of keys, since #additem %1.keys {%i} doesn't work. I have tried combinations of string list functions, such as %dups and %additem to dynamically (and painfully) build a new list with the key added, but so far to no avail. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 20, 2006 1:51 am |
Have you tried just:
Code: |
#additem %1.keys %i |
Not sure if you are saying that the %1.keys doesn't work, or if the {%i} doesn't work. Another thing to try would be to use a local variable:
Code: |
$local=%1;#additem $local.keys $local |
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Thu Jul 20, 2006 11:11 am |
I'm saying that the %1.keys doesn't work. In zMUD, it lets me add a string to the keys key in the %1 data record variable. In CMUD, I get a keys key that contains ".keys|string" instead. I'll try messing with a local variable solution and see if I can't work that out. I somehow suspect it's just a difference in the way #ADDITEM works, though.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jul 20, 2006 5:13 pm |
OK, this sounds like a bug with the %1.keys syntax in the new compiler. I'll add that to the bug list. If you get a chance, send in a feedback report from within CMUD so it doesn't get missed.
|
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Thu Jul 20, 2006 11:25 pm |
every time i try to create a data record variable in the gui it bombs on me hard. I will play around with it some more.
|
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Jul 21, 2006 4:57 am |
Yes, that's been an issue since 1.00 and is on the bug list. You can't use the GUI to create/edit database records right now.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Fri Jul 21, 2006 9:14 am |
does it have to do with the lil hollow square character used to seperate the keys and values apart in zmud?
I remember trying to post a record variable once and these forums dont support that character. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|