• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Trying to change inches to cm

Vampyre

Well-known member
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 !

<!-- 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:
It sounds like you simply want to delete the imperial calculations and store the value as cm. That won't allow for direct import of characters - the data in one version will be stored as a number of inches and in the other version as a number of cm, but it will mean that each click of the arrows increases or decreases the value by 1cm.
 
Thank you Matthias, I wasn't sure there wouldn't be other implications if I didn't made a calculation there. Thanks for the confirmation, I will modify the code then :)
 
Back
Top