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: 6412469" data-attributes="member: 6716025"><p>Ok, It took me some time but I corrected the script above to work, here is the Acroscript version...:</p><p>[CODE]var oldStat = this.getField("St.0").value </p><p>var newStat = this.getField("NewStat1").value </p><p>var oldVal = 0 </p><p>var newVal = 0 </p><p>oldVal = oldStat </p><p>if(oldStat > 90) {oldVal = oldVal + (oldStat - 90) } </p><p>else if(oldStat > 95) { oldVal = oldVal + (oldStat - 95) } </p><p>else if(oldStat > 100) {oldVal = oldVal + ((oldStat - 100) * 7) } </p><p></p><p>newVal = newStat </p><p>if(newStat > 90) {newVal = newVal + (newStat - 90) } </p><p>else if(newStat > 95) {newVal = newVal + (newStat - 95) } </p><p>else if(newStat > 100) {newVal = newVal + ((newStat - 100) * 7) } </p><p>event.value = (newVal - oldVal)[/CODE]/</p><p></p><p>In Acrobat you have to use "else if" statements when using more than 1 "if". Regardless it still does not work. I set a stat at 94 and then put the points into it to raise it two points to a 96 which should come to a total cost of a 5 (2 for raising it to a 95 then 3 to raise it again to a 96). But it calculated the cost as a 4. Consequently that is the same problem I had in my script above.</p><p>Upon further investigation, I changed the stat to a 95 then increased it by 1 (the 2 and finally 5) and it still calculates the cost by doubling the number. Which is incorrect, it should be tripling the number. I will mess with it some more and see if I can find anything else.</p><p></p><p>Bruce</p></blockquote><p></p>
[QUOTE="Madmaxneo, post: 6412469, member: 6716025"] Ok, It took me some time but I corrected the script above to work, here is the Acroscript version...: [CODE]var oldStat = this.getField("St.0").value var newStat = this.getField("NewStat1").value var oldVal = 0 var newVal = 0 oldVal = oldStat if(oldStat > 90) {oldVal = oldVal + (oldStat - 90) } else if(oldStat > 95) { oldVal = oldVal + (oldStat - 95) } else if(oldStat > 100) {oldVal = oldVal + ((oldStat - 100) * 7) } newVal = newStat if(newStat > 90) {newVal = newVal + (newStat - 90) } else if(newStat > 95) {newVal = newVal + (newStat - 95) } else if(newStat > 100) {newVal = newVal + ((newStat - 100) * 7) } event.value = (newVal - oldVal)[/CODE]/ In Acrobat you have to use "else if" statements when using more than 1 "if". Regardless it still does not work. I set a stat at 94 and then put the points into it to raise it two points to a 96 which should come to a total cost of a 5 (2 for raising it to a 95 then 3 to raise it again to a 96). But it calculated the cost as a 4. Consequently that is the same problem I had in my script above. Upon further investigation, I changed the stat to a 95 then increased it by 1 (the 2 and finally 5) and it still calculates the cost by doubling the number. Which is incorrect, it should be tripling the number. I will mess with it some more and see if I can find anything else. Bruce [/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