Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Community
General Tabletop Discussion
*Geek Talk & Media
Need help with a somewhat complex math equation in Java/Acroscript
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Madmaxneo" data-source="post: 6411255" data-attributes="member: 6716025"><p>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. </p><p>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: </p><p></p><p>[CODE]var stat = this.getField("St.0").valuevar value = 0</p><p></p><p></p><p>if (stat > 100) {</p><p> value = (((this.getField("NewStat1").value) - stat) *10) </p><p>}</p><p>else if (stat > 95) {</p><p> value = (((this.getField("NewStat1").value) - stat) *3)</p><p>} else if (stat > 90) {</p><p> value = (((this.getField("NewStat1").value) - stat) *2) </p><p>} else {</p><p> value = ((this.getField("NewStat1").value) - stat)</p><p>}</p><p></p><p></p><p>event.value = value[/CODE]</p><p>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. </p><p>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? </p><p></p><p>Buce</p></blockquote><p></p>
[QUOTE="Madmaxneo, post: 6411255, member: 6716025"] 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: [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[/CODE] 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 [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Geek Talk & Media
Need help with a somewhat complex math equation in Java/Acroscript
Top