18,700
edits
m (marking, in light of upcoming Feral build) |
(updates for Oni 1.2 and taking Daodan DLL into account since everyone has it installed in Windows these days) |
||
Line 1: | Line 1: | ||
'''Variables''' in BSL are very similar to variables in other programming languages. Here's a brief explanation of what a variable is: | '''Variables''' in BSL are very similar to variables in other programming languages. Here's a brief explanation of what a variable is: | ||
Line 5: | Line 4: | ||
The usual thing to do in this situation is to store the needed data in a '''variable''': an elementary data container. | The usual thing to do in this situation is to store the needed data in a '''variable''': an elementary data container. | ||
==General notions== | ==General notions== | ||
Line 19: | Line 17: | ||
An easy way to get the ''type'' and ''value'' of an existing BSL variable is to enter its ''name'' at the console in [[Developer Mode]]: you typically get console output like "bool: 1" or "int32: 42" or "float: 3.14" or "string: hello" | An easy way to get the ''type'' and ''value'' of an existing BSL variable is to enter its ''name'' at the console in [[Developer Mode]]: you typically get console output like "bool: 1" or "int32: 42" or "float: 3.14" or "string: hello" | ||
===Declaration and assignment=== | ===Declaration and assignment=== | ||
If you want to use a new variable (data container), you must set it up (''declare'' it) first, with the '''var''' keyword. A declaration statement can look a bit like this: | If you want to use a new variable (data container), you must set it up (''declare'' it) first, with the '''var''' keyword. A declaration statement can look a bit like this: | ||
Line 33: | Line 29: | ||
On some occasions you may want to declare a ''local'' variable (i.e., to embed a declaration statement into a [[BSL:Functions|function]]). This feature will be detailed elsewhere. | On some occasions you may want to declare a ''local'' variable (i.e., to embed a declaration statement into a [[BSL:Functions|function]]). This feature will be detailed elsewhere. | ||
===Assignment=== | ===Assignment=== | ||
You can assign a new value to an existing variable with the assignment operator "=". The name of the variable you want to modify is on the left-hand-side (LHS) of the "=", and on the right-hand-side (RHS) you can have any valid [[BSL:Expressions|expression]] that evaluates/converts into the variable's type. | You can assign a new value to an existing variable with the assignment operator "=". The name of the variable you want to modify is on the left-hand-side (LHS) of the "=", and on the right-hand-side (RHS) you can have any valid [[BSL:Expressions|expression]] that evaluates/converts into the variable's type. | ||
Line 42: | Line 36: | ||
However, apparently there ''are'' "default" values assigned to every variable even if it hasn't been defined yet. Those values are 0 (i.e., false) for bool, 0 for int and float, and "" (empty string) for string. | However, apparently there ''are'' "default" values assigned to every variable even if it hasn't been defined yet. Those values are 0 (i.e., false) for bool, 0 for int and float, and "" (empty string) for string. | ||
==Built-in variables== | ==Built-in variables== | ||
All the built-in BSL variables are listed here, in alphabetical order. | All the built-in BSL variables are listed here, in alphabetical order. | ||
Line 57: | Line 48: | ||
;Works | ;Works | ||
:"OK": both platforms can use this command | :"OK": both platforms can use this command | ||
:"OK-D": both platforms can use this command, but Windows Oni requires the Daodan DLL | |||
:"OK-M": the command only works on Intel Macs | :"OK-M": the command only works on Intel Macs | ||
:"OK?": confirmation/refinement required | :"OK?": confirmation/refinement required | ||
:"??": command may not work | :"??": command may not work | ||
:"NO": command is proven not to work | :"NO": command is proven not to work | ||
{|border=1 cellspacing=0 cellpadding=2 | {|border=1 cellspacing=0 cellpadding=2 | ||
Line 587: | Line 578: | ||
|bool||marketing_line_off||0 | |bool||marketing_line_off||0 | ||
|"turns the laser line off"||OK | |"turns the laser line off"||OK | ||
|-bgcolor=#ccccff | |||
|float||mouse_acceleration||0.75 | |||
|"sets the mouse acceleration value"||OK | |||
|- | |- | ||
|bool||ob_show_debug||0 | |bool||ob_show_debug||0 | ||
Line 676: | Line 670: | ||
|- | |- | ||
|bool||show_sound_all||0 | |bool||show_sound_all||0 | ||
|"sound rings will always be drawn, not just when a sound is selected"<br>(environment sounds, see BINA/OBJC/SNDG)|| | |"sound rings will always be drawn, not just when a sound is selected"<br>(environment sounds, see BINA/OBJC/SNDG)||bgcolor=#ccccff|OK-M | ||
|- | |- | ||
|bool||show_sound_rectangles||0 | |bool||show_sound_rectangles||0 | ||
|"sound rectangles will always be drawn, not just when a sound Rectangle is selected"<br>(environment sounds, see BINA/OBJC/SNDG)|| | |"sound rectangles will always be drawn, not just when a sound Rectangle is selected"<br>(environment sounds, see BINA/OBJC/SNDG)||bgcolor=#ccccff|OK-M | ||
|- | |- | ||
|bool||show_sound_spheres||0 | |bool||show_sound_spheres||0 | ||
|"sound spheres will always be drawn, not just when a sound Rectangle is selected"<br>(environment sounds, see BINA/OBJC/SNDG)|| | |"sound spheres will always be drawn, not just when a sound Rectangle is selected"<br>(environment sounds, see BINA/OBJC/SNDG)||bgcolor=#ccccff|OK-M | ||
|- | |- | ||
|bool||show_triggers||1 | |bool||show_triggers||1 | ||
|"enables the display of triggers"<br>(see BINA/OBJC/TRIG)||OK | |"enables the display of triggers"<br>(see BINA/OBJC/TRIG)||OK | ||
|- | |- | ||
|bool||show_triggervolumes||0 | |bool||show_triggervolumes||0 | ||
|"Display trigger volumes"||OK | |"Display trigger volumes"||OK-D | ||
|- | |- | ||
|bool||show_turrets||1 | |bool||show_turrets||1 | ||
Line 742: | Line 736: | ||
|- | |- | ||
|int32||wp_fadetime||360 | |int32||wp_fadetime||360 | ||
|"sets free time for powerups"|| | |"sets free time for powerups"||OK-D | ||
|- | |- | ||
|bool||[[wp_force_half_scale]]||0 | |bool||[[wp_force_half_scale]]||0 |