### Object and Car Class: Example Methods
Source: https://docs.sannybuilder.com/language/instructions/classes
Shows examples of using methods from different classes. Object.PutAt positions a crate, and Car.Destroy removes a car. These are typical in-game actions.
```Sanny Builder Script
Object.PutAt($crate, 10.0, -25.5, 12.2)
Car.Destroy($car)
```
--------------------------------
### Sanny Builder Switch Statement Example
Source: https://docs.sannybuilder.com/language/control-flow/switch
Provides a practical example of the Sanny Builder switch statement in action. This snippet demonstrates how to use the switch statement to check the value of a variable (0@) and execute different code blocks based on its comparison with specified cases and a default value.
```pascal
switch 0@
case 1, 2, 3
0ace: "Value is 1, 2, or 3"
case 5
0ace: "Value is 5"
default
0ace: "Value is not 1, 2, 3, or 5"
end
```
--------------------------------
### SCM.INI Opcode Parameter Order Example
Source: https://docs.sannybuilder.com/edit-modes/opcodes-list-scm
Illustrates how parameter order can be customized in the SCM.INI file. The example shows an opcode definition where parameters are rearranged, affecting the output format.
```INI
0053=5,%5d% = create_player %1o% at %2d% %3d% %4d%
```
--------------------------------
### Example: SBL Mode with JSON and INI Opcode Definitions
Source: https://docs.sannybuilder.com/edit-modes
This example illustrates how an SBL (Sanny Builder Language) mode can be configured to use both JSON files for command definitions and INI files for opcodes. JSON definitions are loaded first, and INI definitions loaded second, with INI taking precedence in case of ID collisions. This allows for flexible opcode management.
```xml
```
--------------------------------
### Player Class: Money Property Examples
Source: https://docs.sannybuilder.com/language/instructions/classes
Shows how to interact with the Money property of the Player class. Examples include adding money, checking the amount, and reading the current amount into a variable.
```Sanny Builder Script
Player($PLAYER_CHAR).Money += 1000000 // add more money
```
```Sanny Builder Script
Player($PLAYER_CHAR).Money > 461@ // check the amount
```
```Sanny Builder Script
4@ = Player($PLAYER_CHAR).Money // read the amount and store in variable
```
--------------------------------
### Model Class: Load and Available Example
Source: https://docs.sannybuilder.com/language/instructions/classes
Shows how to use the Model class to load and check the availability of a model. It includes a loop that waits until the model is ready before proceeding.
```Sanny Builder Script
#AK47.Load
:loop
wait 0
if
#AK47.Available
jf @loop
```
```Sanny Builder Script
Model.Load(#AK47)
:loop
wait 0
if
Model.Available(#AK47)
jf @loop
```
--------------------------------
### Player Class: Constructor Examples
Source: https://docs.sannybuilder.com/language/instructions/classes
Demonstrates two equivalent ways to create a new player instance using the Player.Create constructor. One directly calls the constructor, while the other assigns the result to a variable.
```Sanny Builder Script
Player.Create($PLAYER_CHAR, #NULL, 2488.5601, -1666.84, 13.38)
```
```Sanny Builder Script
$PLAYER_CHAR = Player.Create(#NULL, 2488.5601, -1666.84, 13.38)
```
--------------------------------
### Example of a Simple Constant Declaration (Pascal)
Source: https://docs.sannybuilder.com/language/data-types/constants
A straightforward example of declaring a constant named 'x' with a numerical value of 5 in Sanny Builder Pascal. This demonstrates the basic usage of the 'const' keyword.
```Pascal
const x = 5
```
--------------------------------
### Using a Keyword Alias for GOTO
Source: https://docs.sannybuilder.com/language/instructions/keywords
Example of using a defined alias, 'jump', in a Sanny Builder script. The alias 'jump' is functionally equivalent to the 'GOTO' command.
```javascript
jump @label // 'jump' is an alias to the GOTO command
```
--------------------------------
### Opcode with Return Values (Get Time)
Source: https://docs.sannybuilder.com/language/instructions/opcodes
Shows how opcodes can return values, which are then stored in specified variables. The example uses opcode 00BF to retrieve the current in-game hour and minute into two variables.
```assembly
00BF: $hours $minutes
```
--------------------------------
### Sanny Builder: Define and Use Constants
Source: https://docs.sannybuilder.com/editor/language-service
Demonstrates the Sanny Builder syntax for defining constants and how they are recognized and highlighted by the language service. This example shows a simple constant definition and its subsequent usage.
```sannybuilder
const
x = 10
end
x // x gets highlighted
```
--------------------------------
### SCM.INI Opcode Definition Example
Source: https://docs.sannybuilder.com/edit-modes/opcodes-list-scm
Demonstrates the basic syntax for defining an opcode in the SCM.INI file. It specifies the opcode number, the number of parameters, and a human-readable description with a parameter placeholder.
```INI
0001=1,wait %1d% ms
```
--------------------------------
### Opcode with Input Argument (WAIT command)
Source: https://docs.sannybuilder.com/language/instructions/opcodes
Illustrates how to provide an input argument to an opcode, using the WAIT command as an example. The argument specifies the duration in milliseconds for the game to pause.
```assembly
0001: 1000
```
--------------------------------
### Mission Order Example - Sanny Builder
Source: https://docs.sannybuilder.com/troubleshooting/errors/0063
This example demonstrates the correct and incorrect ordering of mission labels in Sanny Builder. The error occurs when a mission label does not follow the expected declaration order, or when an external script is placed between missions. Ensure that missions are declared sequentially and external scripts are placed after all missions.
```sannybuilder
DEFINE MISSIONS 2
DEFINE MISSION 0 AT @MISSION_0
DEFINE MISSION 1 AT @MISSION_1
:MAIN
:MISSION_1 // error, MISSION_0 expected
:MISSION_0
```
--------------------------------
### Import Multiple Functions from Module (Pascal)
Source: https://docs.sannybuilder.com/language/import-export
This syntax example illustrates how to import multiple functions from the same module by separating their names with commas in the 'import' statement. This allows for efficient inclusion of several functionalities from a single library.
```pascal
import , , from ""
```
--------------------------------
### Fixing Missing Parameters for Sanny Builder Commands
Source: https://docs.sannybuilder.com/troubleshooting/errors/0050
Demonstrates how to correct '0050: Not enough parameters for command' errors in Sanny Builder. It shows examples of incorrect parameter usage and their corrected versions, highlighting the need to provide the exact number of required arguments for built-in commands, directives, and class members.
```plaintext
{$INCLUDE} // error, one parameter missing
Player.Defined() // error, one parameter missing
INC() // error, expected two parameters
{$INCLUDE file.txt} // OK
Player.Defined($PLAYER_CHAR) // OK
INC($var) // OK
```
--------------------------------
### Player Class Example: Set Minimum Wanted Level
Source: https://docs.sannybuilder.com/language/instructions/classes
Demonstrates the basic syntax of using a class member. It shows how to set the minimum wanted level for the player character using the Player class and its SetMinWantedLevel method.
```Sanny Builder Script
Player.SetMinWantedLevel($PLAYER_CHAR, 2)
```
--------------------------------
### Player Class: SetClothes with Enum Parameter
Source: https://docs.sannybuilder.com/language/instructions/classes
Example of using a class constant (from an enum like BodyPart) as a parameter to a class method, improving code readability.
```Sanny Builder Script
Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", BodyPart.Torso)
```
--------------------------------
### Sanny Builder Switch Statement Syntax
Source: https://docs.sannybuilder.com/language/control-flow/switch
Defines the fundamental syntax for the switch statement in Sanny Builder. It illustrates how to compare a variable against various cases and handle a default scenario if no match is found. Supported for all games starting from v4.0.
```pascal
switch
case , , ...
// do something if is equal to n1, n2, or n3
case
// do something if is equal to n4
default
// do something if none of the values above matched the variable
end
```
--------------------------------
### Sanny Builder: Shift Offsets with 0000 Opcode
Source: https://docs.sannybuilder.com/troubleshooting/errors/0084
Demonstrates how to use the `0000:` opcode as the first command in a Sanny Builder script to shift subsequent commands. This allows the compiler to represent all offsets with negative numbers, preventing the game from reloading due to jumps to offset 0. The first example shows the error, while the second shows the corrected version.
```Sanny Builder
{$CLEO}
while true
wait 0
end // error, jump to offset 0
```
```Sanny Builder
{$CLEO}
0000:
while true
wait 0
end // OK, jump to offset -2
```
--------------------------------
### WHILE Loop - Infinite Execution
Source: https://docs.sannybuilder.com/language/control-flow/loops
An example of a WHILE loop with a condition set to 'true', causing it to execute indefinitely until explicitly broken. This pattern is useful when the exit condition is determined within the loop body.
```pascal
while true
end
```
--------------------------------
### Insert 'for' loop template
Source: https://docs.sannybuilder.com/edit-modes/code-templates
Demonstrates inserting a predefined 'for' loop code template by typing 'for' and pressing F2. This template includes placeholders for start, end, and step values, along with an end marker.
```text
for = to // step 1
end // for
```
--------------------------------
### Timer Variable Usage in Pascal
Source: https://docs.sannybuilder.com/language/data-types/variables
Shows how to use special local timer variables (TIMERA and TIMERB) to measure elapsed time within a script. The example resets TIMERA and waits for 2 seconds before printing a message.
```pascal
0006: TIMERA = 0 // reset the timer
:WAIT_2S
0001: wait 0 ms
00D6: if
0019: TIMERA > 2000 // if the timer value is > 2000, i.e. 2 seconds has passed
004D: jump_if_false @WAIT_2S
0662: printstring "2 seconds has passed" // display the message
```
--------------------------------
### Declare Multiple Constants Separated by Commas (Pascal)
Source: https://docs.sannybuilder.com/language/data-types/constants
This example shows how to declare multiple constants on a single line in Sanny Builder Pascal by separating each declaration with a comma. This is a concise way to define several constants efficiently.
```Pascal
const a = 1, b = 2, c = 3
```
--------------------------------
### Sanny Builder Bitwise Operations (CLEO)
Source: https://docs.sannybuilder.com/language/instructions/expressions
Provides examples of bitwise operations in Sanny Builder, which require the 'bitwise' CLEO extension. This includes AND, OR, XOR, NOT, MOD, and bit shifts, along with their compound assignment variations.
```sannybuilder
{$USE bitwise}
0@ = 1@ & 2@
0@ = 1@ | 2@
0@ = 1@ ^ 2@
0@ = ~1@
0@ = 1@ % 2@
0@ = 1@ >> 2@
0@ = 1@ << 2@
0@ &= 1@
0@ |= 1@
0@ ^= 1@
~0@
0@ %= 1@
0@ >>= 1@
0@ <<= 1@
```
--------------------------------
### Correcting Opcode Parameters in Sanny Builder
Source: https://docs.sannybuilder.com/troubleshooting/errors/0049
Illustrates the correction of the '0049: Not enough parameters for opcode' error by providing the expected number of parameters for an opcode. This ensures the compiler can process the instruction correctly. The example uses the 'wait' opcode, showing an incorrect usage and its subsequent correction.
```Sanny Builder Script
0001: wait // error, expected one parameter
0001: wait 0 // OK
```
--------------------------------
### Sanny Builder Script Declaration Example
Source: https://docs.sannybuilder.com/troubleshooting/errors/0065
Demonstrates the correct declaration of external scripts in Sanny Builder. Ensure that each script defined with 'DEFINE SCRIPT' has a corresponding label (e.g., ':SCRIPT') in the source file. If a script is not found, the compiler will raise an error.
```sannybuilder
DEFINE MISSIONS 1
DEFINE MISSION 0 AT @MISSION_0
DEFINE EXTERNAL_SCRIPTS 2
DEFINE SCRIPT TEST AT @SCRIPT
DEFINE SCRIPT TEST2 AT @SCRIPT2
DEFINE UNKNOWN_EMPTY_SEGMENT 0
DEFINE UNKNOWN_THREADS_MEMORY 0
:MAIN
:MISSION_0
:SCRIPT
// error, SCRIPT2 not found
```
--------------------------------
### Correcting Parameter Count for Sanny Builder Commands
Source: https://docs.sannybuilder.com/troubleshooting/errors/0081
This snippet demonstrates the correction for the '0081: Too many actual parameters' error in Sanny Builder. It shows an example of an incorrect command call with too many parameters and the corrected version with the appropriate number of parameters, adhering to the command's documentation.
```text
// Error example:
Sqr($var, 1, 2) // Assuming Sqr expects at most 2 parameters, this would cause an error.
// Corrected example:
Sqr($var, 1) // This call now provides the correct number of parameters.
```
--------------------------------
### SCM.INI Ignored Lines Example
Source: https://docs.sannybuilder.com/edit-modes/opcodes-list-scm
Highlights how lines starting with a semicolon (;) are treated as comments and ignored by the Sanny Builder disassembler/compiler when processing the SCM.INI file.
```INI
; This is a comment line and will be ignored.
```
--------------------------------
### CREATE_PLAYER Keyword with Arguments and Storage
Source: https://docs.sannybuilder.com/language/instructions/keywords
Illustrates using the 'CREATE_PLAYER' keyword with multiple arguments, including coordinates and a variable to store the result. Extra words are allowed after the primary arguments.
```pascal
CREATE_PLAYER 0 at 811.875 -939.9375 35.75 store_to $player
```
--------------------------------
### Get Character Weapon (SannyBuilder Script)
Source: https://docs.sannybuilder.com/scm-documentation/vc/weapons
This SannyBuilder script function allows you to retrieve information about a character's weapon. It takes the character entity, slot ID, and optional parameters for weapon type, ammo, and model to specify which weapon to get. The function returns details about the specified weapon.
```SannyBuilder Script
04B8: get_char_weapon in_slot_id type_to ammo_to model_to
```
--------------------------------
### WAIT Command Keyword Usage
Source: https://docs.sannybuilder.com/language/instructions/keywords
Demonstrates the basic usage of a keyword, 'WAIT', in Sanny Builder scripts. It requires a numerical argument.
```pascal
wait 0
```
--------------------------------
### Defining Keyword Aliases in keywords.txt
Source: https://docs.sannybuilder.com/language/instructions/keywords
Shows how to define aliases for existing commands in the 'keywords.txt' file. This allows multiple keywords to map to the same underlying command.
```javascript
0002=jump
0002=goto
```
--------------------------------
### Opcode with Ignored Comments
Source: https://docs.sannybuilder.com/language/instructions/opcodes
Explains that Sanny's compiler ignores non-numeric and non-string tokens as comments. This example shows how 'wait' and 'ms' are disregarded when used with the WAIT opcode.
```assembly
0001: wait 0 ms // 'wait' and 'ms' are ignored
```
--------------------------------
### Local Variable Declaration and Assignment in Pascal
Source: https://docs.sannybuilder.com/language/data-types/variables
Illustrates the declaration and assignment of local variables in Pascal, including integer, float, and string types. It shows how to initialize variables directly upon declaration.
```pascal
int a
float distance
string name
a = 1
distance = 15.5
name = 'CJ'
```
```pascal
int a = 1
float distance = 15.5
string name = 'CJ'
```
--------------------------------
### Keypress Recording (Macro) in SannyScript
Source: https://docs.sannybuilder.com/editor/features
Demonstrates recording and playback of a sequence of keypresses to automate tasks, such as swapping actor handles in SannyScript. This feature allows for complex repetitive actions to be automated efficiently.
```SannyScript
$Actor = Actor.Create(CivMale, #MALE01, 100.0, 100.0, 10.0)
$ActorWithGun = Actor.Create(CivMale, #MALE01, 110.0, 100.0, 20.0)
$Gang01 = Actor.Create(CivMale, #MALE01, 120.0, 100.0, 30.0)
$Gang02 = Actor.Create(CivMale, #MALE01, 130.0, 100.0, 40.0)
$Killer = Actor.Create(CivMale, #MALE01, 140.0, 100.0, 50.0)
$ActorWithoutGun = Actor.Create(CivMale, #MALE01, 150.0, 100.0, 60.0)
```
--------------------------------
### Negated Conditional Opcode
Source: https://docs.sannybuilder.com/language/instructions/opcodes
Illustrates how to negate a conditional opcode by adding 0x8000 to its ID. The example shows the negated version of opcode 0018, which tests if `$var` is less than or equal to 0.
```pascal
if
8018: $var 0 // test if $var is less than or equal to 0
then
...
```
--------------------------------
### Invalid Assignment in Sanny Builder
Source: https://docs.sannybuilder.com/troubleshooting/errors/0014
Illustrates an invalid assignment where a literal number is placed on the left side of an assignment statement. This is an example of an impossible operand in an expression, resulting in an error.
```pascal
5=6
```
--------------------------------
### Continue and Break Commands in WHILE Loop
Source: https://docs.sannybuilder.com/language/control-flow/loops
Demonstrates the usage of 'Continue' and 'Break' commands within a WHILE loop. 'Break' exits the loop entirely, while 'Continue' skips the rest of the current iteration and proceeds to the next.
```pascal
while true
if
not $currentactor.dead
jf Break // exit the loop
if
$currentactor.dead
then
Continue // go to the next iteration
end
end
```
--------------------------------
### REPEAT..UNTIL Loop - Guaranteed Execution
Source: https://docs.sannybuilder.com/language/control-flow/loops
A REPEAT..UNTIL loop that executes its body at least once, even if the condition is initially false. This example shows a loop that will run indefinitely until 'Break' is called.
```pascal
repeat
// the loop has the only iteration
until true
repeat
// the loop executes infinitely until it's stopped with the Break command
until false
```
--------------------------------
### Correct FOR..TO Loop Range
Source: https://docs.sannybuilder.com/troubleshooting/errors/0025
Ensures the initial value is less than or equal to the final value for a FOR..TO loop. This example demonstrates a basic loop iterating from 0 to 5.
```javascript
FOR 0@ = 0 to 5
END
```
--------------------------------
### Including Binary Files with $INCLUDE Directive
Source: https://docs.sannybuilder.com/language/instructions/hex.
The `$INCLUDE` directive within the HEX..END construct allows embedding the content of a binary file directly into the script. Path resolution follows the rules defined for the `$INCLUDE` directive.
```pascal
hex
{$INCLUDE }
end
```
--------------------------------
### External Tool Command-Line Parameters in SannyScript
Source: https://docs.sannybuilder.com/editor/features
Illustrates how to pass Sanny Builder and game directory paths as parameters to external tools launched from Sanny Builder. The special variables `$SB_FileName`, `@sb:`, and `@game:` are used for this purpose.
```SannyScript
Parameters:
--cwd=@sb: --game-dir=@game:
```
--------------------------------
### Configure GTA3 exclusive templates
Source: https://docs.sannybuilder.com/edit-modes/code-templates
Shows how to configure the path for exclusive templates in Sanny Builder using the '' tag in the mode configuration file. This example specifies the path for GTA3 templates.
```xml
@sb:\data\gta3\templates.txt
```
--------------------------------
### FOR Loop Syntax - Pascal
Source: https://docs.sannybuilder.com/troubleshooting/errors/0023
Illustrates the proper syntax for implementing FOR loops in Sanny Builder using Pascal. This includes defining the loop variable, initial and final values, optional step, and the loop body. Refer to the Sanny Builder documentation for detailed loop control flow.
```pascal
FOR = TO/DOWNTO [step = 1]
END
```
--------------------------------
### Correct FOR..DOWNTO Loop Range
Source: https://docs.sannybuilder.com/troubleshooting/errors/0025
Ensures the initial value is greater than or equal to the final value for a FOR..DOWNTO loop. This example demonstrates a loop counting down from 5 to 0.
```javascript
FOR 0@ = 5 downto 0
END
```
--------------------------------
### Writing Raw Hexadecimal Data with HEX..END
Source: https://docs.sannybuilder.com/language/instructions/hex.
This demonstrates the basic syntax for writing raw hexadecimal bytes directly into an output file using the HEX..END construct. It's crucial to ensure correctness as errors can corrupt script files.
```pascal
hex
end
```
```pascal
hex
04 00 02 08 00 04 01
end
```
--------------------------------
### Define a Basic Function in Sanny Builder
Source: https://docs.sannybuilder.com/language/functions
Demonstrates the basic syntax for defining a function using the 'function' keyword, specifying a signature with parameters and a return type, and ending with 'end'. This is useful for organizing code and avoiding duplication.
```pascal
function sum(a: int, b: int): int
int result = a + b
return result
end
```
--------------------------------
### Correct Variable Assignment (C)
Source: https://docs.sannybuilder.com/troubleshooting/errors/0099
Demonstrates the correct way to assign a value to a variable in C. This example shows declaring an integer variable 'x' and assigning the value 5 to it, resolving the 0099 error.
```c
int x = 5
```
--------------------------------
### Spread Arrays in Sanny Builder
Source: https://docs.sannybuilder.com/language/data-types/arrays
Demonstrates the use of the spread syntax (`...`) to expand array elements into individual arguments for commands or function calls. This is useful for commands that return multiple values or require multiple arguments.
```pascal
float pos[3]
...pos = get_char_coordinates $scplayer
set_char_coordinates $scplayer ...pos
```
--------------------------------
### String Variable Declaration in Pascal
Source: https://docs.sannybuilder.com/language/data-types/variables
Demonstrates the syntax for declaring and assigning values to string variables in Pascal. It covers both global (short and long) and local (short and long) string variables.
```pascal
05A9: s$MyString = 'GLOBAL'
05AA: 1@s = 'LOCAL'
```
```pascal
06D1: v$MyString = "LONG_GLOBAL"
06D2: 1@v = "LONG_LOCAL"
```
--------------------------------
### Calling a Function in Sanny Builder
Source: https://docs.sannybuilder.com/language/functions
Demonstrates the basic syntax for calling a function in Sanny Builder. Parentheses `()` are mandatory for function calls, even if the function takes no arguments. Omitting them treats the function name as an offset or address.
```pascal
function foo
end
foo()
```
```pascal
function foo
end
jump foo // jumps into the function body
```
--------------------------------
### Calling Static Foreign Function with Address
Source: https://docs.sannybuilder.com/troubleshooting/errors/0122
This example shows how to resolve the non-static function call error by declaring the foreign function as static and providing its address directly in the function signature. This allows the function to be called by name.
```swift
function CStats__GetStatType(statId: int): int // static foreign function
int value = CStats__GetStatType(0xDEADD0D0) // OK
```
--------------------------------
### Variadic Function with Argument Count in Sanny Builder
Source: https://docs.sannybuilder.com/language/functions
Demonstrates defining a variadic function that can accept a variable number of arguments using the '...args' syntax. It shows how to use 'GET_CLEO_ARG_COUNT' to determine the actual number of arguments passed, useful for dynamic argument handling in CLEO5.
```pascal
function loadModels(...models: int[16]) // allow up to 16 values
int count = get_cleo_arg_count // get actual number of arguments, this is CLEO5 opcode
count--
int i
for i = 0 to count
request_model models[i]
end
load_all_models_now
end
```
--------------------------------
### Correcting Parameter Count in Sanny Builder (Pascal)
Source: https://docs.sannybuilder.com/troubleshooting/errors/0097
This snippet demonstrates how to fix the '0097: Too many actual parameters' error by providing the correct number of arguments for a Sanny Builder instruction. The example uses the 'wait' instruction in Pascal.
```pascal
0001: wait 0 1 // error, expected one parameter
0001: wait 0 // OK
```
--------------------------------
### Returning from a Function in Sanny Builder
Source: https://docs.sannybuilder.com/language/functions
Illustrates how to end a function's execution using the `end` keyword or exit early with the `return` keyword. Early returns are supported in CLEO 5; for older versions, `cleo_return` should be used.
```pascal
function SetWantedLevel(level: int)
set_max_wanted_level level
end // no explicit return, function ends here
function SetWantedLevel(level: int)
if or
level < 0
level > 6
then
return // early return, code below won't be executed
end
set_max_wanted_level level
end // function ends here
```
--------------------------------
### Camera Class: SetBehindPlayer Method (No Instance Parameter)
Source: https://docs.sannybuilder.com/language/instructions/classes
Demonstrates a class method that does not require an explicit class instance parameter, as it operates on a unique entity (the camera).
```Sanny Builder Script
Camera.SetBehindPlayer()
```
--------------------------------
### Correct Variable Naming in Sanny Builder
Source: https://docs.sannybuilder.com/troubleshooting/errors/0021
This example demonstrates the correct way to name local variables in Sanny Builder, which requires integer identifiers. Using string literals for variable names will result in an 'Incorrect variable name' error.
```sannybuilder
var@s = 'test' // incorrect
0@s = 'test' // correct
```
--------------------------------
### Set CLI Options in Sanny Builder
Source: https://docs.sannybuilder.com/editor/cli
This command demonstrates how to use the `-o` flag to set multiple options for the Sanny Builder executable. These options are applied only to the current session and are not persistent. Dependencies include the Sanny Builder executable (`sanny.exe`) and valid option names like `Compiler::CheckConditions` and `Editor::LanguageService`.
```bash
sanny.exe -o Compiler::CheckConditions 0 -o Editor::LanguageService 1
```
--------------------------------
### Invalid Function Argument Example - Pascal
Source: https://docs.sannybuilder.com/troubleshooting/errors/0105
This snippet illustrates an incorrect function definition in Pascal that would trigger the '0105: Expected a function argument name' compiler error. The comma following the function name is an invalid identifier in this context.
```pascal
function foo(,)
```
--------------------------------
### Run Sanny Builder without Splash Screen CLI
Source: https://docs.sannybuilder.com/editor/cli
Launches Sanny Builder without displaying the initial splash screen. This can be useful for faster startup or in environments where the splash screen is not desired.
```bash
sanny.exe --no-splash
```
--------------------------------
### Fix Redundant AND Operator in Sanny Builder Condition
Source: https://docs.sannybuilder.com/troubleshooting/errors/0073
Demonstrates how to correct a conditional statement in Sanny Builder where an 'AND' operator is used with a single condition. The provided examples show the incorrect usage and the corrected versions, either by removing the operator or adding another condition.
```sannybuilder
if and
0@ == 1 // error, AND is used for a single condition
then
//
end
if
0@ == 1 // OK
then
//
end
if and
0@ == 1
1@ == 1 // OK
then
//
end
```
--------------------------------
### Pascal: Calling Function via Pointer
Source: https://docs.sannybuilder.com/troubleshooting/errors/0121
This Pascal code demonstrates how to call a function using a function pointer. First, a pointer variable is defined, then it's assigned the memory address of the function at runtime, and finally, the function is invoked through this pointer.
```pascal
CStats__GetStatType method // define a pointer to function Destroy
...
method = 0x400000 // function is located at 0x400000
int value = method(0xDEADD0D0) // call function using the pointer
```
--------------------------------
### Swift: Remove export keyword from foreign function
Source: https://docs.sannybuilder.com/troubleshooting/errors/0126
This code example shows how to resolve the 'Can't export a foreign function definition' error by simply removing the 'export' keyword from the foreign function declaration. This makes the function local.
```swift
function foo()
```
--------------------------------
### Duplicate Constant Declaration Example (Sanny Builder)
Source: https://docs.sannybuilder.com/troubleshooting/errors/0090
This code snippet demonstrates a scenario that triggers the '0090: Duplicate Constant' error. It shows a constant declaration followed by a local variable declaration with the identical name, violating Sanny Builder's declaration rules.
```sannybuilder
const x = 1
int x
```
--------------------------------
### Variable Type Declaration and Initialization in Pascal
Source: https://docs.sannybuilder.com/language/data-types/variables
Demonstrates declaring variable types and initializing them with a value in Pascal. The compiler can infer opcodes when types are known. Variable types can be re-declared to change their type within different script contexts.
```pascal
var $Var1: Integer, $Var2: Integer
$Var1 += $Var2 // opcode 0058
var $fVar: float = 1.0
// or
float $fVar = 1.0
// Example of re-declaring variables in different script contexts
script_name 'Food'
var
10@ : Float
$Var : Float
end
$var = 1
10@ = $Var
end_thread
thread 'Loop'
var
10@ : Int
$Var : Int
end
$var = 1
10@ = $Var
end_thread
```
--------------------------------
### Resolve Duplicate Script Names in Sanny Builder
Source: https://docs.sannybuilder.com/troubleshooting/errors/0042
This solution demonstrates how to ensure unique names for external scripts in Sanny Builder. It shows an example of an erroneous script definition and the correct way to define unique script names to prevent conflicts.
```sannybuilder
DEFINE SCRIPT RACE AT @LABEL
DEFINE SCRIPT RACE AT @LABEL2 // error, RACE has already been used
DEFINE SCRIPT RACE2 at @LABEL2 // OK
```