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
Panpardus
Beginner


Joined: 27 Feb 2005
Posts: 11

PostPosted: Fri Feb 16, 2007 1:02 pm   

Help with a db command
 
Ok i have an alias lets call it 'away' and it needs to work in reference with a DB var and another variable

Firstly the databases are all names of people with a few stats in them
eg Bob is the name of the database and it has class and number keys
for bob class =monk and number = 1234 for the database Jim class= mage and number =9876

This is the tricky part for me

Now if i have Bob as my target (@tar=bob) and i type 'away' i want the alias to go "put @bob.number in pack", if i have Jim targeted then i wan't it to go "put @jim.number in pack"

how do i get it to do this besides from having an IF for every possible name

like i dont want to go #if (@tar= "bob") {put @bob.number in pack} as there could be 2000 names.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Feb 16, 2007 1:31 pm   
 
Either of these will work:

#alias away {put @{@tar}.number in pack}
#alias away {put %db(@{@tar},number) in pack}
Reply with quote
Panpardus
Beginner


Joined: 27 Feb 2005
Posts: 11

PostPosted: Fri Feb 16, 2007 2:53 pm   
 
Thanks
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