Jump to content

BSL:Manual: Difference between revisions

157 bytes added ,  5 December 2015
→‎fork: I suppose it's worth noting this bug with "fork"
(→‎Compound statements: explanation of "scope")
(→‎fork: I suppose it's worth noting this bug with "fork")
Line 448: Line 448:
  }
  }


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.
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. Also be aware that accidentally calling a nonexistent function using "fork" will crash Oni; when "fork" is not used, the errant call will simply be ignored.


Below are two types of uses for the "schedule" keyword. By scheduling a function call that operates on global variables and doesn't run unless a condition is true, you can simulate a "for" loop with these keyword sets.
Below are two types of uses for the "schedule" keyword. By scheduling a function call that operates on global variables and doesn't run unless a condition is true, you can simulate a "for" loop with these keyword sets.