PDA

View Full Version : RMC Ability Bonuses



Veldehar
December 10th, 2009, 16:36
I've been trying to pull up the ability bonus for various stats with no success. I've been able to get the temp, race, special and total via "source=abilities.constitution.temp" for example, but all attempts at the Ability Bonus have gone ppphhhbbbt, to use a technical term. I should be able to reverse engineer the ability bonus by taking the total and subtracting the others, but that seems silly if there is an easier way, LOL.

Any thoughts would be appreciated! My pile of extra resistances would surely appreciate the help!

Veldehar

Veldehar
December 10th, 2009, 20:19
Okay, I might have narrowed down what I need to do, or not...

In file optionsmanager.lua I found this reference to ability bonuses:

-- "abilitybonus",abilitywindow - returns the bonus calculated for a given ability score.

Which is interesting as options.lua contains the script that produces the ability bonus. From other research, it looks like I would "invoke" this optionsmanager, but I've no idea how I would do. Any hints would be great, my LUA knowledge is slowly developing, but it is rather slow.

Veldehar

Veldehar
December 10th, 2009, 23:12
I'm still curious about this one, but I went ahead and slipped in a reverse engineered version of pulling the stat bonus. Works great, so good enough for me!

Veldehar

Foen
December 11th, 2009, 07:08
There is no facility to access the ability bonus directly, but there some alternatives:

You can acces the total bonus (bonus+race+special) by using "abilities.constitution.total". This is the way resistance rolls and skills access the stat bonuses;
If your code is running in the Main character sheet window, and you have a variable pointing to the ability window in question (each ability is just a window in a list, so the constitution ability is represented by its own window) you can invoke the option manager to calculate the bonus using bonus=OptionManager.invoke("abilitybonus",win); or
You can amend the abilitywindow code in charsheet_listclasses so that the numbercontrolX for the bonus (lines 1384-1401) is a numberfieldX instead. Then you can access the bonus using abilities.constitution.bonus.

Hope that helps

Stuart

Veldehar
December 12th, 2009, 14:33
Excellent, good info as always!

Veldehar