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


Joined: 19 Nov 2010
Posts: 119

PostPosted: Thu Nov 25, 2010 7:18 pm   

Database variables again..
 
Ok this might sound like a very stupid question but say i've got a database variable called test with

Key=Value
test1=nice1
test2=nice2
test3=nice3

Now if i type @test.test1 it will return me the value of nice1, if i use %db(@test,test1) and finally if i use @test.1 it will return me nice1 again. Is there any way to access the name of the key without using #loopdb ? Having 3 ways to see value and no way to see a key is weird, or am i missing something ?
Reply with quote
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Thu Nov 25, 2010 8:15 pm   
 
Oh found a 4th way to access a value now! %item(@dbvar, linenumber) will not retrieve a key..
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Thu Nov 25, 2010 8:22 pm   
 
Not sure how you want to use this so here it is in the form of an alias.
Code:
<alias name="GetKey" id="12">
  <value>$val = %isvalue(@test,%-1)
$key = %dbkey(@test, $val)
#show {$key} </value>
</alias>


typing getkey nice3 will return test3
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Thu Nov 25, 2010 8:25 pm   
 
hmm , says invalid local variable $key
Reply with quote
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Thu Nov 25, 2010 8:28 pm   
 
Ah nice, looked through your script and found out that i wasnt using %dbkey before ;) That's the command i was looking for (almost), thanks! Still would be nice to have a way to acess dbkey by providing a dbvalue!
Reply with quote
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Thu Nov 25, 2010 8:35 pm   
 
Thank you Fizgar, that allowed me to complete my trigger at last :)
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