Madmaxneo
Explorer
This is for Adobe Acrobat which uses an enhanced form of Javascript, but I believe Javascript wil work so if you have a Javascript solution please post it.
I am developing an auto-calculating character sheet in Acrobat Pro XI, so far it is coming along great. Except for one (currently) minor roadblock. In this game it is possible to raise your stats every level through the use of this table: [TABLE="width: 200, align: center"]<tbody>[TR][TD]Stat range[/TD][TD]Cost per point[/TD][/TR][TR][TD]1-90[/TD][TD]1[/TD][/TR][TR][TD]91-95[/TD][TD]2[/TD][/TR][TR][TD]96-100[/TD][TD]3[/TD][/TR][TR][TD]101-105[/TD][TD]10[/TD][/TR]</tbody>[/TABLE]Basically if you have a stat of 75 and want to raise it 5 points then it will cost you 5 DP's (development points). If you have a stat of 89 and want to raise it 2 points it will cost you 3 points, 1 to raise it to a 90 then 2 to raise it to a 91, etc. I have a simple script that works as long as you don't raise it more than through one set at a time, i.e. if you have a 94 and try to raise it to a 96 it will not calculate the cost correctly. Here is my script for those that can understand it:
Where St.0 is one of the 8 stats, in this case it is Strength (in the script above it becomes "stat" from the "var stat" part of the script) and NewStat1 is the what the new stat will be once the points are added.
The problem is, as I described above, if you have a 94 and try to raise it to a 96 it will not calculate the cost correctly. As a 94 to a 95 costs 2 points but from a 95 to a 96 costs 3 points the total should be a 5 but in the script above it comes out to a 6. Can anyone please help me figure this out?
Buce
I am developing an auto-calculating character sheet in Acrobat Pro XI, so far it is coming along great. Except for one (currently) minor roadblock. In this game it is possible to raise your stats every level through the use of this table: [TABLE="width: 200, align: center"]<tbody>[TR][TD]Stat range[/TD][TD]Cost per point[/TD][/TR][TR][TD]1-90[/TD][TD]1[/TD][/TR][TR][TD]91-95[/TD][TD]2[/TD][/TR][TR][TD]96-100[/TD][TD]3[/TD][/TR][TR][TD]101-105[/TD][TD]10[/TD][/TR]</tbody>[/TABLE]Basically if you have a stat of 75 and want to raise it 5 points then it will cost you 5 DP's (development points). If you have a stat of 89 and want to raise it 2 points it will cost you 3 points, 1 to raise it to a 90 then 2 to raise it to a 91, etc. I have a simple script that works as long as you don't raise it more than through one set at a time, i.e. if you have a 94 and try to raise it to a 96 it will not calculate the cost correctly. Here is my script for those that can understand it:
Code:
var stat = this.getField("St.0").valuevar value = 0
if (stat > 100) {
value = (((this.getField("NewStat1").value) - stat) *10)
}
else if (stat > 95) {
value = (((this.getField("NewStat1").value) - stat) *3)
} else if (stat > 90) {
value = (((this.getField("NewStat1").value) - stat) *2)
} else {
value = ((this.getField("NewStat1").value) - stat)
}
event.value = value
The problem is, as I described above, if you have a 94 and try to raise it to a 96 it will not calculate the cost correctly. As a 94 to a 95 costs 2 points but from a 95 to a 96 costs 3 points the total should be a 5 but in the script above it comes out to a 6. Can anyone please help me figure this out?
Buce