Use one field to determine which calculation a different field is used in?

Explorer ,
May 13, 2019

Copy link to clipboard

Copied

So i'm making a PDF for a game i'm making. I make a drop down field that decides whether a gear used is armor or shield. If it's armor, then the Defense field I added will be added to the armor spot, and if its a shield, to the shield spot. How would I do that?

Basically, if something is an armor, and it gives two defense, it shows +2 in the armor section. If its a shield and gives +2 armor, it shows + 2 in the shield section. I'm new to this program, and don't know any javascript.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

140

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Use one field to determine which calculation a different field is used in?

Explorer ,
May 13, 2019

Copy link to clipboard

Copied

So i'm making a PDF for a game i'm making. I make a drop down field that decides whether a gear used is armor or shield. If it's armor, then the Defense field I added will be added to the armor spot, and if its a shield, to the shield spot. How would I do that?

Basically, if something is an armor, and it gives two defense, it shows +2 in the armor section. If its a shield and gives +2 armor, it shows + 2 in the shield section. I'm new to this program, and don't know any javascript.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

141

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 13, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

What are the names of the fields involved?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

Untitled.png

The two drop down menus for the gear are called "ArmorCategory1" and "ArmorCategory2" and they each have two options, armor or shield.

The two fields that you put the +2 in are called "ArmorClass1" and "ArmorClass2"

The two fields showing the armor and shield are called "AC2" and "AC3"

Depending on which option you choose for the drop down menu, the "ArmorClass1/2" will go to either "AC2" or "AC3"

Kinda complicated, idk if possible

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

What should happen if both drop-down fields are set as "Armor" (or "Shield")?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

Both Armor Classes get put into the armor section

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

Sorry, I don't understand. If one of the drop-downs is set to Armor then the text field should show "+2", right? And if none then it should be empty? So what should it show if both are set to "Armor? Still "+2"?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

Sorry, im bad at explaining stuff, lets use the image I posted

So theres the armor category drop down field. That lets you choose between shield and armor

Then below that, theres the armor class field. So lets say for armor 1, I choose armor, and below that, in the armor class field, I put 2. How do I make it so that +2 gets added to the armor spot in the general info field that is shown with the red line? And, If I switch the armor category to shield, the +2 instead gets put into the shield section of the general info

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

OK, that's a bit clearer. However, there are still some issues. Doe the Armor field already have a value that you want to add the new value to? What should happen if the user changes the value of the Armor Class field from 2 to 3? It would then add 3 to the original value, which already had 2 added to it... As you can see, this is not so simple.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

The armor class field has no value in it, you put a number in there, and that number is added to which ever box corresponds to the dropdown menu field above it. If they change it from 2 to 3, the only thing that should change is the part in general info says 3 instead of 2.

Here are images explaining

Untitled1.png

Untitled2.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

I was referring to the Armor/Shield fields at the top.

Imagine the following scenario:

- User fills in "6" in the Armor text field.

- User selects "Armor" from drop-down.

- Use enters "4" into "Armor Class" text field.

- Armor text field changes to 10. So far so good, right?

- Now user changes their mind and goes back to the "Armor Class" text field and changes it from "4" to "2".

- The value in the "Armor" text field will become 12, because we've set it up so that it adds up the value of the "Armor Class" field to the current value. This is not correct, is it? It should be 8. So we need to not only add the current value, but also deduct the previous value of the field, which is tricky.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

Well i made the Total HP field use a simplified field notation, so it calculates the HP based off stats not shown in the image. WHen I try to manually change the value, it doesn't let me. I figured it was the same thing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

But then you won't be able to enter a value into it at all...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Explorer ,
May 14, 2019

Copy link to clipboard

Copied

I don't mind. If the person doesn't put anything in the armor spot, they don't get any armor bonus. Thats just how life be, you get me?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
try67 LATEST
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

We seem to have our wires crossed here. I'm not able to follow what you want to achieve. Maybe someone else can help you out.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0