Quicky: does calling a script run asynchronously? [SOLVED]

Discussion in 'Programming' started by Christopher Alexander, Jan 10, 2019.

Tags:
  1. Christopher Alexander

    Christopher Alexander Member

    Joined:
    Nov 12, 2016
    Posts:
    27
    Just wondering as I've hit a bump in the road, the title says it all actually. Will a block of code "wait" for a script to finish or does it continue asynchronously?

    Does it go:

    1)
    CODE
    CODE
    SCRIPT START
    SCRIPT CONT
    SCRIPT END
    CODE
    CODE

    or:

    2)
    CODE
    CODE
    SCRIPT START
    CODE + SCRIPT CONT
    CODE + SCRIPT END

    Am I making sense?

    Edit:

    By "script start" I mean y'know script_execute(scriptName);
     
  2. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    1,101
    It uses run order number 1. You can check this yourself by stepping through an event with a script somewhere in the code. The event code will run normally up until it hits the script then it will step through the script code, then revert back to the original event code and execute the rest of it. It HAS to do this because a script can return a result after it has finished and it's possible that the game will need that result in order to make sense of the rest of the event code (for instance, if the script returns a true or false and is in an if statement; how would the computer know whether that if was true or not if the script ran AFTER the entire event had completed?).
     
    Cpaz likes this.
  3. Christopher Alexander

    Christopher Alexander Member

    Joined:
    Nov 12, 2016
    Posts:
    27
    Thank you kindly.
     
    RefresherTowel likes this.
  4. DukeSoft

    DukeSoft Member

    Joined:
    Jun 20, 2016
    Posts:
    768
    look at the code as a folder structure - it just opens the first thing it sees, everytime.

    SCRIPT A:
    do thing B
    call SCRIPT C
    do thing E

    SCRIPT B:
    do thing D

    compiler will run A, B, C, D, E
     
  5. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,303
    Rather:

    Code:
    SCRIPT A:
      do thing B
      call SCRIPT C
      do thing E
    
    SCRIPT C:
      do thing D
    And now it's ABCDE, what you wrote was a compiling error ;)
     
    BattleRifle BR55 and Simon Love like this.
  6. DukeSoft

    DukeSoft Member

    Joined:
    Jun 20, 2016
    Posts:
    768
    yeah that makes more sense ;p
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice