We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

4.2 loop variables no longer exposed to Java Script ?

Home Forums Programming 4.2 loop variables no longer exposed to Java Script ?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #60364
    xeon
    Customer

    I was wondering if anyone out there is experiencing issues with puzzles like repeat where the variable in the puzzles is “i”. It seems that these variables are no longer exposed to JavaScript? We have found a work around by assigning the i Var to another varialble and then accessing that in JS but why would we need to do this?

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com

    #60366
    kdv
    Participant

    duplicate deleted

    #60371
    kdv
    Participant

    And yes, and no. Implemented in 4.2.0.

    The variable is still in the list of variables (should be removed completely), but it’s not used. This removes probable issues like here. It’s a bad practice to declare loop’s variables and procedure’s arguments as global variables.

    We have found a work around by assigning the i Var to another varialble and then accessing that in JS but why would we need to do this?

    Congrats! ))) You’ve found the correct solution commonly used )))

    for (let j = 0; j > array.length; j++) {
      if (someCondition)
        someGlobalVar = array[j];
    }

    or

    for (let j in array) { // also works with dictionaries
      if (someCondition)
        someGlobalVar = array[j];
    }

    j is a variable for the inner use inside loops, it should not be global.

    #60445
    xeon
    Customer

    For anyone having this same issue…we have contacted Soft8Soft and have received the following: “Vars missing in JS is actually a bug which we’re going to fix in the upcoming Verge3D preview release.”

    This is excellent news.

    Xeon
    Route 66 Digital
    Interactive Solutions - https://www.r66d.com

    #60446
    kdv
    Participant

    They are not missing ))) You can open visual_logic.js and see them. They are just not used outside loops.

    #60469

    They are not missing ))) You can open visual_logic.js and see them. They are just not used outside loops.

    We’re going to fix only the case when some custom JS code executed within loops. The globals outside the loop will be “undefined” as before.

    Verge3D’s Tech Chief
    FB | Twitter | VK

    #60471
    kdv
    Participant

    Now I understand what you are talking about ))) It’s your exec script puzzle that can read variables only from VARS…

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.