18,700
edits
m (→if: wording) |
(→fork: clarifying why no-fork call to nonexistent function doesn't crash; it's not a "fork" bug, really) |
||
Line 445: | Line 445: | ||
} | } | ||
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 | 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, BSL will not recognize that the unknown function name represents a function, and thus will not attempt to call it and end up crashing. | |||
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. |