|
rob Novice
Joined: 12 Oct 2000 Posts: 30 Location: Australia
|
Posted: 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? |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: 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 :) |
|
|
|
rob Novice
Joined: 12 Oct 2000 Posts: 30 Location: Australia
|
Posted: Wed Feb 14, 2007 9:50 am Cheers i thought it was something like that nt |
nt
|
|
|
|
|
|