• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with using javascript on button press to generate random output

New Here ,
Jun 03, 2020 Jun 03, 2020

Copy link to clipboard

Copied

Hello, I'm new to both programming and adobe, I've been working on a fillable form using pro dc and right now what I'm trying to do is create a button that will generate a random result from a list and then show the result. Here is the bit of code that I have and this code works in VSC.

 

const critB = ["Crunch: Target is sickened 3.""Where Am I?: Normal damage. Target is stunned 2""Surprise Opening: Until end of turn you gain an additional action to use as an attack against the target.",
 "Cracked Rib: Target is fatigued.""Feeble Parry: Target drops one weapon.""Cracked Knee: Until healed the target is clumsy 2 and takes a -5-foot status penalty to land Speed."
 "Bell Ringer: Target is sickened 2 and is stupefied 2 until no longer sickened.""Split Open: Target takes 1d6 persistent bleed damage.""Momentum: Gain a +2 circumstance bonus to all attack rolls until next turn."
 "I See Stars: Normal damage. Target is dazzled until healed.""Broken Nose: Target takes 1d4 persistent bleed damage.""Crushed Toe: Normal damage. Until healed target is clumsy 2 and takes a -10-foot status penalty to land Speed.",
 "Numbing Blow: Normal damage. Target is clumsy 1 for 1 minute and must succeed a Reflex save or drop 1 item it holds at random.""Crumpling Blow: Target is knocked prone""Shattered Hand: Normal Damage. Until healed, target is clumsy 2 and enfeebled 2, and can't use one of its hands.",
 "Two For One: Deal normal damage to one target adjacent to the original target.""And Stay Down!: Normal damage. Target is knocked prone and stunned 2.""Rattled: Normal damage. Target is confused for 1 round.",
 "Nighty Night: Normal damage. Target falls unconscious and can't wake up until the end of its next turn.""Brained: Target is stunned 1.""Collapsed Lung: Normal damage. Until healed, target is enfeebled 2 and fatigued.",
 "Bone Masher: Normal damage. Either target is clumsy 2 and takes a -10-foot status penalty to land Speed OR is clumsy 2 and can't use one of its arms (your choice). Either effect lasts until healed.""Overwhelming Smash: Triple damage.""Ruptured Spleen: Normal damage. Target takes 1 persistent bleed damage that can't be removed until the target has been subject to magical healing.",
 "Off Balance: Normal damage. The target triggers reactions as if it just used a move action. It is also flat-footed until the end of its next turn.""Crushed Intestines: Normal damage. Target is wounded 2 and enfeebled 2 until it is no longer wounded.""Crushed Trachea: Target is suffocating until subject to magical healing. It can't speak while suffocating.",
 "Skull Crush: Target is stupefied 3 until healed.""Caved Skull: Triple damage. Target must succeed at a Fortitude save or die.""To Your Thinky Bits: Target is stupefied 2 until healed.",
 "Dazing Thud: Target is stunned 1.""Clocked!: Triple damage. Target is knocked prone.""Broken Ribs: Normal damage. Target is slowed 1 until healed.",
 "Staggering Blow: Target is stunned 2.""Thunder Strike: Target is deafened until healed.""Box The Ears: Target is deafened until healed.",
 "Concussion: Normal damage. Target is confused for 1 minute and stupefied 2 until healed.""Armor Dent: Normal damage. Deal the same amount of damage to the target's armor, ignoring that armor's hardness.""Soul-Crushing Blow: Target is doomed 1 and is stupefied 1 as long as it is doomed.",
 "Breathless: Target is fatigued.""Broken Leg: Target takes a -15-foot penalty to its land Speed until healed.""Shield Smack: Target must succeed at a Reflex save or drop a shield it's holding.",
 "My Teef!: Target must succeed at a DC 5 flat check to cast spells with the verbal component until healed.""Knockback: Target is pushed 1d4x5 feet away.""Low Blow: Target is sickened 2 and slowed 1 as long as it remains sickened.",
 "Busted Shin: Until healed, target is clumsy 1 and takes a -10-foot status penalty to its land Speed.""Back Breaker: Until healed, the target is clumsy 2 and enfeebled 2.""Busted Shin: Until healed, the target is clumsy 1 and takes a -10-foot status penalty to its land Speed.",
 "Solid Blow: Triple damage.""Tiring Blow: Target is fatigued.""Foot Smash: Target is flat-footed util the end of its next turn.",
 "Lights Out: Target is blinded until the end of its next turn.""Roundhouse: Make one additional attack against a foe adjacent to the original target, using the same attack modifier as the original attack."];
const randomCrit = critB[Math.floor(Math.random() * critB.length)];

console.log("random crit =>"randomCrit);
 
But I'm having issues thinking about how to move this to adobe and have it still fuction as above.
TOPICS
Windows

Views

228

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
community guidelines
no replies

Have something to add?

Join the conversation