PDA

View Full Version : number control operations



Veelivar
March 25th, 2006, 19:10
With the <source name="hideranks" op="+" /> tag in number controls is it opossible to do multiply and divide as well as + and add?

Cheers,

Dan.

Veelivar
March 26th, 2006, 16:28
Ok I've had a little dig around and it seems that it some kind of multiplication is possible.

You can do something like:
<source name="Anumbercontrol" op="+" />
<source name="Bnumbercontrol" op="+" />
<source name="M_current" op="*" />

and it looks like it adds uo Anumbercontrol and Bnumbercontrol then multiplies by M_current.

What I want to be able to do is M_current*2? is this possible? (I expected something like <source name="M_current" op="*" value="2" /> but this is a no go)

I've tried a couple of ideas like having another numbersontrol withe the value that I want but I don't kno how to set an initial value.

Any ides?

cheers.

Dan

Veelivar
March 26th, 2006, 22:56
It's abit of an outragous hack (please tell me if there is a better way) but I have managed to solve it by doing the following:



<numbercontrol name="dummy">
<invisible />
<value type="readonly" />
</numbercontrol>

<numbercontrol name="10">
<invisible />
<value type="readonly" />
<source name="dummy" op="+" valuemap="0:10" />
</numbercontrol>

<numbercontrol name="S_bonus">
<bounds rect="430,357,30,18" />
<font name="georgia3" />
<center />
<nodrop />
<noreset />
<value type="readonly" />
<source name="S_current" op="+" />
<source name="10" op="/" />
<description text="Strength Bonus" />
<tabtarget next="T_bonus" prev="Run_range" />
<hideonvalue value="0" />
</numbercontrol>


This allows me to be able to initialise a number control to a particular value. It seem very convulted to me and I must have missed the tag to do this, seems to work though which is what is important at the moment.

Basically what the code is doing is creating a dummy numbercontrol which is 0 (seems to be the default value?) then adds this to another numbercontrol but subtitutes 10 for 0. This means that I can now use a known value of '10' in calculations which I then use to get my strength bonus from the current strength value (the charsheet is for Warhammer v2).