Jump to content

BSL:Tutorial/Scratch: Difference between revisions

→‎Part 1 : Knowing your formats: moving Shell-Style page here; no point in being separate
m (OSL to BSL)
(→‎Part 1 : Knowing your formats: moving Shell-Style page here; no point in being separate)
Line 11: Line 11:
The types are :
The types are :


Shell-Style:
'''Shell-Style''':
This is compiled much like some System-Shells. It is written in a "one-function-call-a-line" format, and is the easiest to begin with if you have had no coding experience, as the code is neatly displayed line after line. The downside of this it, that once you get into more complex scripts or scripts with many function calls, the file becomes very hard to read and very large. Also, an great tool, passing information through a command, cannot be done using Shell-Style.
This is compiled much like some System-Shells. It is written in a "one-function-call-a-line" format, and is the easiest to begin with if you have had no coding experience, as the code is neatly displayed line after line. The downside of this it, that once you get into more complex scripts or scripts with many function calls, the file becomes very hard to read and very large. Also, an great tool, passing information through a command, cannot be done using Shell-Style.


Example: [[Shell-Style]]
Example:


C-Style:
func p2
{
ai2_doalarm muro1 11
fork follow
ai2_spawn tarmac_striker_3
ai2_spawn cruel_striker1
ai2_spawn Hangar1_A_Striker_3
ai2_spawn Start_Striker_5
ai2_spawn Roof2_Striker_1
ai2_spawn Hangar1_B_Striker_5
chr_teleport tarmac_striker_3 199
chr_teleport cruel_striker1 200
chr_teleport Hangar1_A_Striker_3 108
chr_teleport Start_Striker_5 109
chr_teleport Roof2_Striker_1 110
chr_teleport Hangar1_B_Striker_5 117
ai2_attack tarmac_striker_3 muro1
ai2_attack cruel_striker1 muro1
ai2_attack Hangar1_A_Striker_3 muro1
ai2_attack Start_Striker_5 muro1
ai2_attack Roof2_Striker_1 0
ai2_attack Hangar1_B_Striker_5 0
}
 
'''C-Style''':
This is compiled much like the popular coding style C. The syntax can be placed into multiple-function lines and functions are divided by a ''';''' . In advanced scripts, this style will allow you to condense your script and the parts will be easier to read/debug. It also allows you to utilize some of the more advanced features easily. The problem with this is, that starting off, it is harder to write if you have had no previous experience with coding.
This is compiled much like the popular coding style C. The syntax can be placed into multiple-function lines and functions are divided by a ''';''' . In advanced scripts, this style will allow you to condense your script and the parts will be easier to read/debug. It also allows you to utilize some of the more advanced features easily. The problem with this is, that starting off, it is harder to write if you have had no previous experience with coding.