|
adamwalker Apprentice
Joined: 12 Mar 2005 Posts: 195
|
Posted: Mon May 14, 2007 11:33 pm
cant get #addkey to work how i want |
#ADDKEY tester {%1} {%eval(%db(@tester, "%1") + 1)}
the above code should creat the key if it doesnt exist. and add 1 to its value if it does exist. but it doesnt appear to add the +1. any ideas?
thanks |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon May 14, 2007 11:58 pm |
You've got %1 quoted.
|
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Tue May 15, 2007 12:01 am |
Code: |
#ADDK tester {%1} %if( %iskey( @tester, %1), %eval( %db( @tester, %1) + 1), 0)
|
OR
Code: |
#ADD tester.%1 %if( %iskey( @tester, %1), 1, 0)
|
OR
|
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue May 15, 2007 12:09 am |
edit: whoops, two responses while I was writing, heh. anyway
might be a better way of doing this, but it should work
#ADDKEY tester {%if(%null(%db(@tester, %1)),%1,%1=%eval(%db(@tester, %1)+1))} |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
|
|