View Single Post
Vampyre
Member
 
Join Date: Sep 2013
Posts: 78

Old June 18th, 2014, 07:02 AM
Hello again,

So, I basically almost done it with the inches and feet to cm value. The only problem I have now with the code, is that it uses rounded value. When I apply to the right arrow, or left arrow, the value is not going up by one step increment, but by 3 (2.54 rounded). Do you guys have a better code for bringing the height of a character to cm instead of the imperial system ? I will change the weight as well for my character, but if those two values (height and weight) are both stored in imperial, it's ok, as long as I can enter them and read them as being metric ?

Many thanks for the help !

Quote:
<!-- Height of the actor (in cm) -->
<field
id="perHeight"
name="Height"
type="user"
maxfinal="20"
defvalue="68">
<!-- Bound the age to within the limits specified for the actor -->
<bound phase="Render" priority="10000"><![CDATA[
@minimum = field[perHtMin].value
@maximum = field[perHtMax].value
]]></bound>
<!-- Final value for display is converted from inches to feet and inches -->
<finalize><![CDATA[
~calculate the height in terms of feet and inches
var feet as number
var inches as number
feet = @value * 2.54
feet = round(feet,0,-1)
inches = @value - (feet * 12)

~synthesize appropriate text to display the height properly
@text = feet & " cm"
if (inches <> 0) then
@text = @text & " " & inches & chr(34)
endif
]]></finalize>
</field>

Last edited by Vampyre; June 18th, 2014 at 07:12 AM.
Vampyre is offline   #1 Reply With Quote