Jump to content

BSL:Tutorial/Scratch: Difference between revisions

Line 330: Line 330:
{<br>
{<br>
<br>
<br>
    my_save_point = save_point;<br>
<br>
<br>
     if (my_save_point eq 0)<br>
     if (save_point eq 0)<br>
     {    <br>
     {    <br>
         ...<br>
         ...<br>
     }<br>
     }<br>
<br>
<br>
     if (my_save_point eq 1)<br>
     if (save_point eq 1)<br>
     {<br>
     {<br>
         ...<br>
         ...<br>
     }<br>
     }<br>
<br>
<br>
    if (my_save_point eq 2)<br>
}</tt>
    {<br>
 
        ...<br>
Using forking, you can link save points to functions. Like so :
    }<br>
 
<tt>func void main(void)<br>
{<br>
<br>
<br>
     if (my_save_point eq 3)<br>
     if (save_point eq 0)<br>
     {<br>
     {   <br>
         ...<br>
         fork logic<br>
     }<br>
     }<br>
<br>
<br>
     if (my_save_point eq 4)<br>
     if (save_point eq 1)<br>
     {<br>
     {<br>
         ...<br>
         fork logic2<br>
     }<br>
     }<br>
<br>
<br>
    if (my_save_point eq 5)<br>
    {<br>
        ...<br>
    }<br>
}</tt>
}</tt>


When save point 0 is loaded (TCTF Training), the function "logic" is executed. If save point 1 is loaded (Syndicate Warehouse), "logic2" is executed. Note that in Warehouse, the save point number in the script is one higher than in the level load list, because "TCTF Training" is SP0.




85

edits