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
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon May 14, 2007 11:58 pm   
 
You've got %1 quoted.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: 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
Code:

#add tester.%1 1
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: 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... ;)
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