Saving data from for loop to file and then read the data and plot graphs

I have a for loop which generates random matrices, then performs a few calculations to yield a bunch of different values. Essentially, something like so: For[j = 1, j < 100, j++, a={{1}{2}{3}{4}},b={{5}{6}{7}{8}},c=Tr[a],d=Tr[b], e=c+d, {a,b,c,d,e}>>> file]

Of course in the above, we repeat the same values over and over, I am using this as an example as the script would be too long and requires a list of different packages. I need to save these values to a file in a way that I can then extract the values and create a bunch of different graphs. What is the best way to go about this?

Saving URL to database

I am having trouble saving the selected attachment URL to the database.

The value of the hidden input seems to get the value, but the value is not being stored in the database.

<?php  global $  wpdb; $  table_name = $  wpdb->prefix . 'wpclc_logos';  // Add variables $  message = ''; $  notice = '';  // Set defaults $  default = array(     'id' => 0,     'status' => '',     'img' => '',     'label' => null,     'start' => null,     'end' => null );  // Verify nonce if( wp_verify_nonce( $  _REQUEST['nonce'], basename(__FILE__) ) ) {      // Combine default item with request params     $  item = shortcode_atts( $  default, $  _REQUEST );      // validate data, and if all ok save item to database     // if id is zero insert otherwise update     $  item_valid = wpclc_validate_items($  item);      // Validate form     if( $  item_valid === true ) {          if( $  item['id'] == 0 ) {              $  result = $  wpdb->insert( $  table_name, $  item );             $  item['id'] = $  wpdb->insert_id;              if( $  result ) {                  $  message = __('Logo was successfully added', 'wpclc_text_domain');              } else {                  $  notice = __('There was an error while saving logo', 'wpclc_text_domain');              }          } else {              $  result = $  wpdb->update( $  table_name, $  item, array( 'id' => $  item['id'] ) );              if( $  result ) {                  $  message = __('Logo was successfully updated', 'wpclc_text_domain');              } else {                  $  notice = __('There was an error while updating logo', 'wpclc_text_domain');              }          }      } else {          $  notice = $  item_valid;      }  } else {      $  item = $  default;      if( isset( $  _REQUEST['id'] ) ) {          $  item = $  wpdb->get_row($  wpdb->prepare("SELECT * FROM $  table_name WHERE id = %d", $  _REQUEST['id']), ARRAY_A);          if( ! $  item ) {              $  item = $  default;             $  notice = __('Logo not found', 'wpclc_text_domain');          }      }  }  /**  * Error alert messages for validation  */ function wpclc_validate_items($  item) {     $  messages = array();      //if( empty( $  item['img_url'] ) ) $  messages[] = __('Image not selected', 'wpclc_text_domain');     if( empty( $  item['label'] ) ) $  messages[] = __('Label is not set', 'wpclc_text_domain');     if( empty( $  item['status'] ) ) $  messages[] = __('Status is not set', 'wpclc_text_domain');     if( empty( $  item['start'] ) ) $  messages[] = __('Start date is not set', 'wpclc_text_domain');     if( empty( $  item['end'] ) ) $  messages[] = __('End date is not set', 'wpclc_text_domain');      if( empty($  messages) ) {          return true;          }      return implode( '<br />', $  messages ); }  ?>  <div class="wrap">      <div class="icon32 icon32-posts-post" id="icon-edit"><br></div>      <h1>              <?php _e('Add new logo', 'wpclc_text_domain')?>          <a class="add-new-h2" href="<?php echo get_admin_url(get_current_blog_id(), 'admin.php?page=wpclc_settings');?>">             <?php _e('Back', 'wpclc_text_domain')?>         </a>      </h1>      <?php if (!empty($  notice)): ?>          <div id="notice" class="error">             <p>                 <?php echo $  notice ?>             </p>         </div>      <?php endif;?>      <?php if (!empty($  message)): ?>          <div id="message" class="updated">             <p>                 <?php echo $  message ?>             </p>         </div>      <?php endif;?>      <form id="wpclc_form_add" method="POST">          <input type="hidden" name="nonce" value="<?php echo wp_create_nonce(basename(__FILE__))?>"/>          <input type="hidden" name="id" value="<?php echo $  item['id'] ?>"/>          <table cellspacing="2" cellpadding="5" style="width: 100%;" class="form-table">              <tbody>                  <tr class="form-field">                     <th valign="top" scope="row">                         <label for="img"><?php _e('Image', 'wpclc_text_domain')?></label>                     </th>                     <td>                         <input id="img_url" type="hidden" name="img_url" value="<?php echo esc_attr($  item['img_url'])?>">                         <button id="img" name="img" type="button" class="button">Choose or upload image</button>                         <span id="img_text" style="margin-left:1rem; line-height:30px;"></span>                     </td>                 </tr>                 <tr class="form-field">                     <th valign="top" scope="row">                         <label for="label"><?php _e('Label', 'wpclc_text_domain')?></label>                     </th>                     <td>                         <input id="label" name="label" type="text" style="width: 95%" value="<?php echo esc_attr($  item['label'])?>"                             size="50" class="" placeholder="<?php _e('Christmas', 'wpclc_text_domain')?>" required>                     </td>                 </tr>                 <tr class="form-field">                     <th valign="top" scope="row">                         <label for="status"><?php _e('Status', 'wpclc_text_domain')?></label>                     </th>                     <td>                         <select id="status" name="status" style="width: 95%" value="" class="" required>                             <option value='active'>Active</option>                             <option value='inactive'>Inactive</option>                         </select>                     </td>                 </tr>                 <tr class="form-field">                     <th valign="top" scope="row">                         <label for="start"><?php _e('Start Date', 'wpclc_text_domain')?></label>                     </th>                     <td>                         <input id="start" name="start" type="date" style="width: 95%" value="<?php echo esc_attr( date( "d/m/Y", strtotime( $  item['start'] ) ) ); ?>" class="" required>                     </td>                 </tr>                 <tr class="form-field">                     <th valign="top" scope="row">                         <label for="end"><?php _e('End Date', 'wpclc_text_domain')?></label>                     </th>                     <td>                         <input id="end" name="end" type="date" style="width: 95%" value="<?php echo esc_attr( date( "d/m/Y", strtotime( $  item['end'] ) ) ); ?>" class="" required>                     </td>                 </tr>              </tbody>          </table>          <input type="submit" value="<?php _e('Save', 'wpclc_text_domain')?>" id="submit" class="button-primary" name="submit">              </form>  </div> 

The images below show the results I recieve when I add a new entry to the database. As you will see, the img section contains no content at all. It is setup in the database as a VARCHAR(255).

enter image description here enter image description here

Please ignore the errors in the console, they simply relate to the date input not being of YYYY-mm-dd format.

What do you do when a spell or something says that the target needs to do a saving throw without a number for the throw? [duplicate]

For command, it states, "The target must succeed on a Wisdom saving throw or follow the command on its next turn" without any context to how high the target needs to roll for it to succeed. What does the target need to roll to succeed that saving throw? Is the number specific for command or is it the same for all spells like this? I’d like to get all the info I can for this.

Can a creature under Dominate Person choose to willingly fail the saving throw from Calm emotion if the caster is viewed as an enemy?

The description of the Calm emotions spell says:

You attempt to suppress strong emotions in a group of people. Each humanoid in a 20-foot-radius sphere centered on a point you choose within range must make a Charisma saving throw; a creature can choose to fail this saving throw if it wishes.

If a player controlled by Dominate Monster is asked to kill his allies, could he willingly fail the saving throw since he view them as ennemies and calm emotion could be "dangerous" for him?

If you succeed on the saving throw for the Sickening Radiance spell, do you still take the level of exhaustion and emit the light?

The Sickening Radiance spell says:

When a creature moves into the spell’s area for the first time on a turn or starts its turn there, that creature must succeed on a Constitution saving throw or take 4d10 radiant damage, and it suffers one level of exhaustion and emits a dim, greenish light in a 5-foot radius.

The grammar and punctuation here makes me wonder: do the level of exhaustion and greenish light happen regardless of the result of the saving throw, just like how some spells still deal half damage when you succeed on the save?

I suspect they do. Otherwise it should have been written "…must succeed on a Constitution saving throw or take 4d10 radiant damage, suffer one level of exhaustion, and emit a dim, greenish light…"

Pact of the Chain, Sprite Familiar. What does it mean that a “saving throw result is 5 or lower”?

I’ve been looking into the warlocks Pact of the Chain, which states that your allowed to pick from the normal familiars as well as a select few Warlock-Only familiars, including the Sprite.

When you cast the spell, you can choose one of the normal forms for your familiar or one of the following special forms: imp, pseudodragon, quasit, or sprite.

Then invocation Investment of the Chain Master states that:

If the familiar forces a creature to make a saving throw, it uses your spell save DC.

And the Sprite has a Shortbow attack that forces a creature to make a saving throw:

Shortbow. Ranged Weapon Attack: +6 to hit, range 40/160 ft., one target. Hit: 1 piercing damage, and the target must succeed on a DC 10 Constitution saving throw or become poisoned for 1 minute. If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration, or until it takes damage or another creature takes an action to shake it awake.

From what I gather that means that the initial save for the poison should use the players save DC? So for a lvl 7 character with 20 charisma, that would be a save of 16?

Spell save DC = 8 + your proficiency bonus + your Spellcasting modifier

However the second part of the Shortbow attack states that:

If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration

What does "saving throw result is 5 or lower" mean? Would that be the rolled number for the save + the save modifier?

saving throw result = save dice roll + save score modifier

Or would it be the resulting rest from removing the spell save DC from the rolled total?

saving throw result = Spell save DC – (save dice roll + save score modifier)

I haven’t seen the phrase "saving throw result" referring to a number before, usually it just refers to "did the creature roll over or under the spell save DC? Yes or No."

When is the Saving Throw rolled for an Infernal Wound?

This came up in a game I was running yesterday.

Two devils (Bearded and Horned) in 5e have weapons that deliver "infernal wounds", which are basically bleed effects. The creatures can be found in the Monster Manual, pgs. 70 and 74, respectively, or here and here.

For convenience, here’s the full text of the ability (Bearded Devil version, bold emphasis mine):

If the target is a creature other than an undead or a construct, it must succeed on a DC 12 Constitution saving throw or lose 5 (1d10) hit points at the start of each of its turns due to an infernal wound. Each time the devil hits the wounded target with this attack, the damage dealt by the wound increases by 5 (1d10). Any creature can take an action to stanch the wound with a successful DC 12 Wisdom (Medicine) check. The wound also closes if the target receives magical healing.

The Horned Devil version coincides word for word with this one, except that the wound damage is 10 (3d6) instead of 5 (1d10) and the Saving Throw DC is 17.

That said, me and my players disagreed over what was the correct interpretation of this rule, namely as to when the save should happen. There are two possible interpretations and both seem grammatically correct:

  1. If the attack hits, the target is wounded, no save rolled. At the start of each of its following turns, the target rolls a Con Save, taking damage only on failures.
  2. If the attack hits, the target rolls a Con Save. On a failure, it is wounded and will take damage on the start of each of its following turns, no save rolled.

Is there any official ruling on what is the correct interpretation?

What is considered a successful death saving throw?

I’m fairly new to D&D and I wanted to run a session with some friends. I’ve been doing a lot of research but can’t seem to find an answer to this question. I understand how the mechanic works, three successes or rolling a 20 being stabilized and the opposite being death. However what I want to know is what would be considered a success? Is this up to the DM or is there a guide? I would assume anything above 10 would be a success and anything below would be a failure but I’d like clarity.

Do characters know if someone else, who they can see, has failed a saving throw?

Do characters know if someone else, who they can see, has failed a saving throw?

In particular, let’s consider the following cases:

  1. a caster has cast a spell, that requires a saving throw, and that doesn’t require concentration, on an enemy (not a damaging spell, let’s consider the spell Command for example), at the moment of the cast, since this information can influence the strategy of the caster before the command is eventually executed;
  2. an ally is making a death saving throw, this can influence the priorities of the allied of that character.