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


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Sat Jul 30, 2005 5:00 pm   

Something like %item but in data record
 
Hello!
I'm thinking about function, that will works like %item in string lists, but with data record variables.

Eg.
data = ogr=1|gnome=2|dwarf=3
etc etc.. let's say we have 100 position in variable data.

How to simply and fast take 3th position from @data ?
If it where a string list, I can make %item(@data,3). But this is data record. How to do it without loops? Any ideas?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Jul 30, 2005 8:42 pm   
 
%db(@data,dwarf)
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Sun Jul 31, 2005 7:52 am   
 
Nexela I has written that I want the 3th position in variable, and I don't know that 3th is dwarf
I dont want to use loop.
I want just something like %item(@data,3) but this wouldn't work with data record variable.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Jul 31, 2005 11:30 am   
 
Code:
#VAR getN {%item(%expanddb(@data,|,|),%eval(%1*2))}


#EVAL @getN(3)
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Sun Jul 31, 2005 11:42 am   
 
Heh, yea. This is some way.
Thx Dharkael.

By the way. Maybe somedays will be option to numeric positions in data record variable.
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