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
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 13, 2002 5:04 am   

what is the format in %dbget(rec[,format])?
 
Does anyone know the format used in the database function %dbget(rec[,format]) to return formatted values?

I have not been able to figure it out. The help documents do not give an example for it. Is that parameter working?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 13, 2002 8:57 am   
 
Any number except zero. You can also use on, true, or yes.

LightBulb
Vague questions get vague answers
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 13, 2002 11:16 am   
 
Was my question really vague?

Are you saying that %dbget(%rec,1), %dbget(%rec,on), %dbget(%rec,true), %dbget(%rec,yes) are supposed to work?
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Mon May 13, 2002 12:10 pm   
 
Help files say:
If format is present and is non-zero, the values returned are formatted (for Number fields) otherwise raw data is returned.

Eg. for the sample char that is part of a full zMUD installation you can do a:
#SHOWDB %dbget(147sa,0)
getting:
Num: 147sa
Name: implants, borg
Cost: 200000
Hit: 4
...

while a
#SHOWDB %dbget(147sa,1)
gives:Num: 147sa
Name: implants, borg
Cost: 200,000 DM
Hit: +4
...

as you can see there is only a difference in the number fields, where formatting
like +/- signs or currency (dependent on the systems global settings) are inserted.

(Yes, I know that DM isn't official currency anymore, but I don't really care.)
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 13, 2002 1:21 pm   
 
Thanks Sildaren!

I use 'general' non-negative numbers in my databases with no use of currencies. That is why I did not notice any +/- or $/DM changes.

I have just recently started to fiddle with the database again. I forgot all about #SHOWDB. So all my outputs were in one line including control characters, which made it hard to read.

Very well explained. Thank you very much!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 13, 2002 3:05 pm   
 
No, I'm not saying your question was vague. That's just my current sig which I started using because I had tired of telling people we needed specifics. Your question is fine.

Yes, that's precisely what I'm saying. %dbget(%rec,1), %dbget(%rec,on), %dbget(%rec,true), %dbget(%rec,yes) all work. So do %dbget(%rec,37) and %dbget(%rec,-5).

I'm glad Sildaren thought to include the actual difference between formatted and unformatted records, that probably helped more than the actual answer.

LightBulb
Vague questions get vague answers
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 13, 2002 4:28 pm   
 
Thanks LightBulb!
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