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
rob
Novice


Joined: 12 Oct 2000
Posts: 30
Location: Australia

PostPosted: Wed Feb 14, 2007 9:07 am   

Question about a database record and %word function
 
Gday this is an example of a record in my database:

Num: 247eq
Long: an engraved black lance
Names: engraved black lance
Flags:
Level: 10
Value: 278 copper
Material/Wt: wood / 9 pounds 15 ounces
Type: polearm
AC P/B/S/M:
Damage: 3d5 average 9
Attack_Type: Pierce
Charges:
Spells:
Affects:
ItemDesc: A long black lance lies here.
Special:
From: A black knight in Aldevari

when i do a #DBGET 247 and do a #SHOWDB it shows this
when i do a #SHOW '%word(&damage,3)' it returns '9'

so i want to be able to only grab a record if the damage is say greater than 8 so i use these commands and get the following results:

#IF (%word(&damage,3)>10) {#ECHO GOOD} {#ECHO BAD} returns GOOD

#IF (%word(&damage,3)=9) {#ECHO GOOD} {#ECHO BAD} returns GOOD

#IF (%word(&damage,3)<10) {#ECHO GOOD} {#ECHO BAD} returns BAD

Also if i use a record with damage in 2 digits like 12, 21 etc everything works.

something is screwy i tried single quotes around 10 but makes no difference

any ideas?
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed Feb 14, 2007 9:31 am   
 
Use %float(%word(&damage,3)) to force it to become a number as it is currently treating it as a string which is why the comparisons are not working as you expect.
_________________
Taz :)
Reply with quote
rob
Novice


Joined: 12 Oct 2000
Posts: 30
Location: Australia

PostPosted: Wed Feb 14, 2007 9:50 am   Cheers i thought it was something like that nt
 
nt
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