Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
TerrellKl
Novice


Joined: 30 Aug 2005
Posts: 49

PostPosted: Thu Sep 29, 2005 6:07 pm   

collecting the value off a random Key
 
#addkey playerc1 %item( @list, %random( %numitems( @list))) (i dunno what to put here to make it the same value from the random item)

eh.. %item doesnt work.. need to find out what it is for database records(variable). any help is appriciated

In short, what i need to do is capture a random Key and the key's Value from a Database record and put it in a variable. HELP!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Sep 29, 2005 9:01 pm   
 
If I get this right then you are seeking to generate a random number based on how many keys you have in a record variable. You then wish to retrieve a key and value pair that happens to match that random position. If I am right then you are looking for something like:
PlayerC1=%item(%expanddb(@recordVar,"|"),%random(%numkeys(@recordVar)))

This will produce an output similar to Key=Value.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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