I used bool parameter in my animator controller setting it to true by script but where should I set it back to false and when?

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI;  public class FireEffect : MonoBehaviour {     public Transform player;     public Transform target;      private float timeElapsed = 0;     private float lerpDuration = 3;     private float startValue = 1;     private float endValue = 0;     private float valueToLerp = 0;      private Animator playerAnimator;     private bool prevFacing = false;     private bool stopped = false;     private bool move = true;     private bool rot = false;     private Vector3 currPos;      private void Start()     {         playerAnimator = player.GetComponent<Animator>();     }      private void Update()     {         var currFacing = IsFacing(target);         if (currFacing != prevFacing)         {             timeElapsed = 0;         }         prevFacing = currFacing;          var distance = Vector3.Distance(player.position, target.position);          if (IsFacing(target))         {             if (distance < 10 && move)             {                 if (timeElapsed < lerpDuration)                 {                     valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);                     playerAnimator.SetFloat("Forward", valueToLerp);                     timeElapsed += Time.deltaTime;                 }                 playerAnimator.SetFloat("Forward", valueToLerp);                 stopped = true;                 valueToLerp = 0;             }              if (move == false)             {                 playerAnimator.SetFloat("Forward", 0);             }              if (playerAnimator.GetFloat("Forward") == 0 && stopped)             {                 move = false;                 rot = true;                 currPos = player.position;                 stopped = false;                 Debug.Log("Player current position when valueToLerp value is 0 : " + currPos);             }         }                  if(rot)         {             playerAnimator.SetBool("Walk Back", true);              rot = false;         }          if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Walk Back"))         {             playerAnimator.SetBool("Walk Back", false);         }     }      private bool IsFacing(Transform target)     {         Vector3 forward = player.TransformDirection(Vector3.forward);         Vector3 toTarget = target.position - player.position;         return Vector3.Dot(forward, toTarget) > 0;     }      public IEnumerator ScaleOverSeconds(Vector3 scaleTo, Vector3 rotateTo, Vector3 moveTo, float seconds)     {         float elapsedTime = 0;         Vector3 startingScale = player.localScale;         Vector3 startingRotation = player.localEulerAngles;         Vector3 startingPosition = player.localPosition;          while (elapsedTime < seconds)         {             player.localScale = Vector3.Lerp(startingScale, scaleTo, (elapsedTime / seconds));             player.localEulerAngles = Vector3.Lerp(startingRotation, rotateTo, (elapsedTime / seconds));             player.localPosition = Vector3.Lerp(startingPosition, moveTo, (elapsedTime / seconds));              elapsedTime += Time.deltaTime;              yield return null;         }         player.localScale = scaleTo;         player.localEulerAngles = rotateTo;         player.localPosition = moveTo;     } } 

At this part, I’m setting the bool to true once and it’s playing the "Walk Back".

if(rot)             {                 playerAnimator.SetBool("Walk Back", true);                      rot = false;             }                  if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Walk Back"))             {                 playerAnimator.SetBool("Walk Back", false);             } 

After that, I’m setting the trigger to false when it’s finishing playing it because if I will not set it to false it will keep playing the "Walk Back" nonstop.

I want that it will play it once but also when rot is true again then play it again once. but because I’m setting it false it’s not playing it again even if rot is true again.

animator controller

I created a transition from the Grounded blend tree to the Walk Back with the bool condition in the screenshot.

The Walk Back is working fine smooth as I wanted the problem is now how to make it play once only each time rot is true?

The way or the place in the script I’m setting the bool back to false make it that it will not play the Move Back ever again even if rot is true.

Upgrade script from PHP 5.6 to 7.2 appear error for Paypal

Hello

My website is about to people can buy some software from my website. There is one icon on site where user can see "buy now".When user click on that icon then he will be redirected to Paypal,and then make a payment.

Now the problem is when i was switch from PHP 5.6 to PHP 7.2 in Whm that action just give to me blank screen.So that mean that for 7.2 PHP version can't finish payment with Paypal.

Just to mention script work great with other functions as Home and contact page,and is full…

Upgrade script from PHP 5.6 to 7.2 appear error for Paypal

How I make my Jupyter notebook script locked?

I have multiple scripts using the IRkernel on Jupyter notebook. I have to put them on a server, but I want to make it not editable and not deletable, it is kind of lock. The aim is that people can only run the script. I have already tried things, mainly by modifying the metadatas like that :

{
"deletable": false,
"editable": false,
"trusted": true }

But when it would be on the server, others people can modify the metadatas, so it is not really what I want. Is there a way to make my script fully locked and that nobody can editable it ?

How does the following script manage to pull data from an external domain without requiring CORS headers?

Script in Question: http://samples.geekality.net/image-fetcher/

You can click "view source" at the bottom to pull up the exact PHP and Javascript being used.

I used part of this script to extract images on a site of mine from another on separate domains and servers. I had to go to the one being scraped and add a CORS header "Access-Control-Allow-Origin" to allow my specific domain to do the AJAX $ .post and actually receive data.

The script above does not require any site to have the CORS header for security. As far as I can tell I’m doing nothing different.

I have an HTML form then I’m grabbing the field data with jQuery and doing a $ .post where the action is a PHP file that uses DomDocument to grab the HTML. The PHP then sorts through the data and echoes a JSON object. Then the jQuery sorts it all out and displays it on the page. Same thing they’re doing.

I can’t see how they’re getting around the need for a "Access-Control-Allow-Origin" header on the site they’re grabbing images from?

Thanks for your time and energy in this!

Convert HTML Script to Shortcode

I want to convert this code into a shortcode from the Code Snippets plugin, I have seen an example come up but when I put it it does not work, the example is the following:

add_shortcode( 'shortcode_name', function () {      $  out = '<p>write your HTML shortcode content here</p>';      return $  out; } ); 

I want to convert the following code to rotate banners:

<script>       rnd.today=new Date();     rnd.seed=rnd.today.getTime();      function rnd() {         rnd.seed = (rnd.seed*9301+49297) % 233280;         return rnd.seed/(233280.0);     }      function rand(number) {         var result = Math.floor(rnd() * number);         if (!result) result = 0;         return result     }     var bannerimgs = new Array("a.jpg", "b.jpg");     var bannerlnks = new Array("a.com", "b.com");     var banneralt = new Array("a", "b");     var rotatorHtml = "";     var endJs = "";      for(var img in bannerimgs){         var thisImg = new Image();         thisImg.src = bannerimgs[img];     }     var bannerimgCt = 2;     var bannercurrentAd = rand(bannerimgCt);     var openlink = "";     var bannerbanner = document.getElementById('banner');     var bannerlink = document.getElementById('banneradLink');              if(bannerlnks[bannercurrentAd] != ""){         rotatorHtml += '<a href="' + bannerlnks[bannercurrentAd] + '" id="banneradLink"  target="_blank">';         endJs = "</a>";     }     rotatorHtml += '<img src="' + bannerimgs[bannercurrentAd] + '" alt = "' + banneralt[bannercurrentAd] + '" id="bannerbanner">' + endJs;     document.getElementById("banner_div").innerHTML = rotatorHtml;   </script> 

How can this script be converted to a shortcode? I have replaced what it says but errors appear, then I do something wrong. How can this script be converted to a shortcode? Do you know any other way?

Woocommerce custom script ajax post form data fails to be captured in backend

I am using woocommerce and I wanna customize admin page’s coupon section.

So I use the following code snippet such that I can write my own codes in my_script.js.

add_action('admin_enqueue_scripts', 'add_custom_js_file_to_admin'); function add_custom_js_file_to_admin($  hook) {     $  screen = get_current_screen();     if ( 'shop_coupon' === $  screen->id ) {         wp_enqueue_script('my_script', plugin_dir_url(__FILE__) . 'js/my_script.js');     } } 

I am successful to create a new custom field: Taxonomy as shown in the pic below. And ajax post request’s header indicates that the data should be sent correctly (the red box in the pic). I am

However, my backend code snippet below fails to retrieve the data from the post request ( eg: $ tax below is null):

add_action('woocommerce_coupon_options_save', 'save_coupon_text_field', 10, 2); function save_coupon_text_field($  post_id, $  coupon)     {       $  tax = $  _POST['wc_sc_taxonomy_restrictions[0][tax]'];       $  coupon->update_meta_data('taxonomy_tax', $  _POST['wc_sc_taxonomy_restrictions[0][tax]']);       $  coupon->update_meta_data('taxonomy_op', $  _POST['wc_sc_taxonomy_restrictions[0][op]']);       $  coupon->save();     } 

I got 2 questions:

(1) Can someone kindly share any idea on what’s wrong with my codes above?

(2) In the custom script my_script.js, I wanna call an api which serves to retrieve data from my database; the data will then be used as the options available for the taxonomy’s drop-down select box. Can anyone tell me how I can do so in my_script.js? Normally in my BE php file, I wrote sth like below, yet I don’t know how I can perform sth similar in my custom script:

 global $  wpdb;  $  result = $  wpdb->get_results('some sql here'); 

OpenXR device not present in Start or Awake methods in Unity C# script

I’m developing a VR game using OpenXR in Unity (specifically developing on a Valve Index). When I try to access the input devices through the InputDevices.GetDevices() function, I get 0 devices back when I call this function from my script’s Awake() or Start() methods. But when I call the same function from my script’s Update() method, I see all the devices (e.g. head set, left controller, right controller).

Why can’t I see the devices in the Awake() or Start() methods?

Illusory Script contract fraud

I have an idea, I am playing a classic contract-type fiend warlock very much a "sign on the dotted line and you will have ____…. in exchange for your soul" and I was planning on using Illusory Script for contract fraud and want to know if it would work. For example, I write up a contract that says "I (warlock name) will give you a cup of tea, in exchange, you (victim name) will give me your soul… sign here _____" But then use an illusion to make it bog-standard fair contract. Obviously, the areas you sign are the same on both versions. Are there any obvious issues or workaround I would worry about?

Preventing a missing or faulty plugin loaded inside of wp-settings from halting a script

foreach ( wp_get_active_and_valid_plugins() as $  plugin ) {     echo $  plugin;     wp_register_plugin_realpath( $  plugin );     include_once $  plugin;      /**      * Fires once a single activated plugin has loaded.      *      * @since 5.1.0      *      * @param string $  plugin Full path to the plugin's main file.      */     do_action( 'plugin_loaded', $  plugin );     echo 'end'; } 

So I have a script that loads wp-settings and the script halts at: /var/www/public/wp-content/plugins/w3-total-cache/w3-total-cache.php. I am thinking that do_action(‘plugin_loaded’, $ plugin); throws an exception and stops the script from running, how do you prevent an exception like that from halting a script? I tried to put a try catch, but it doesn’t work.