Jump to content

BSL:Manual: Difference between revisions

201 bytes removed ,  6 December 2015
→‎fork: wording; removing note about sleep from here, because it belongs in the "Loop" section
m (→‎return: more specific link)
(→‎fork: wording; removing note about sleep from here, because it belongs in the "Loop" section)
Line 447: Line 447:
  }
  }


You can use forked functions to print delayed messages using "sleep" without holding up other scripted actions, as well as use built-in functions that hold up BSL, like [[chr_wait_animation]] to wait for a condition to be true before performing some action. However, do not "fork" call the same function again before it finishes running, as this will have undesired effects. Using "sleep" before each call can prevent this overlapping execution.
As you can see, you can use forked functions to perform delayed actions without holding up the rest of the script; this not only allows the use of "sleep", but also any built-in functions that hold up BSL by design, like [[chr_wait_animation]].


Also be aware that accidentally calling a nonexistent function using "fork" will crash Oni; when "fork" is not used, BSL will not recognize that the unknown function name represents a function, and thus will not attempt to call it and end up crashing.
Also be aware that accidentally calling a nonexistent function using "fork" will crash Oni; when "fork" is not used, BSL will not recognize that the unknown function name represents a function, and thus will not attempt to call it and end up crashing.