### Stat Literal Examples in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md These snippets show examples of stat literals in CS2, which represent skills. ```CS2 attack ``` ```CS2 smithing ``` -------------------------------- ### Instruction Call with Arguments (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example of calling a standard instruction (`sound_synth`) with multiple arguments provided within parentheses. ```CS2 Script sound_synth(2266, 1, 0); ``` -------------------------------- ### Instruction Call Without Arguments (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example of calling a standard instruction (`clan_leavechat`) that does not require any arguments. Parentheses can be omitted in this case. ```CS2 Script clan_leavechat; ``` -------------------------------- ### Procedure Call with Arguments (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example of calling a custom procedure (`~min`) defined elsewhere, indicated by the leading tilde (`~`). Arguments are passed within parentheses. ```CS2 Script ~min($a, $b); ``` -------------------------------- ### Boolean Literal Examples in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md These snippets show the boolean literals available in CS2. ```CS2 true ``` ```CS2 false ``` -------------------------------- ### Font Metrics Literal Example in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows an example of a fontmetrics literal in CS2, which represents a font. ```CS2 p11_full ``` -------------------------------- ### Line Comment Syntax (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Illustrates the syntax for single-line comments in CS2 Script, starting with `//`. Any text following `//` on the same line is ignored by the interpreter. ```CS2 Script // This is a comment ``` -------------------------------- ### Component Literal Example in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the format for a component literal in CS2, representing an interface component. It is written as the interface name, a colon, then the component name. ```CS2 poh_jewellery_box:frame ``` -------------------------------- ### Integer Literal Examples in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md These snippets show examples of 32-bit signed integer literals in CS2. Integers can be written normally or as hexadecimal values. The value 'null' is equivalent to -1 for integers. ```CS2 5 ``` ```CS2 -10 ``` ```CS2 0x7f7f7f ``` -------------------------------- ### Procedure Call Without Arguments (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example of calling a custom procedure (`~wilderness_level`) that does not require arguments. The leading tilde (`~`) is used, and parentheses can be omitted. ```CS2 Script ~wilderness_level; ``` -------------------------------- ### Defining Procedure Signature in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the signature format for a CS2 Procedure. Procedures can take arguments and return values, and are called from other scripts. This example defines a procedure named 'min' that takes two integer arguments ($a, $b) and returns a single integer. ```CS2 [proc,min](int $a, int $b)(int) ``` -------------------------------- ### String Literal Examples in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md These snippets show examples of string literals in CS2. Strings are sequences of characters enclosed in double quotes. String interpolation is supported by embedding expressions within angle brackets inside a string literal. ```CS2 "Show" ``` ```CS2 "Magic level: " ``` -------------------------------- ### Named Object Literal Example in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows an example of a namedobj literal in CS2, which represents an item explicitly specified by name in the code. Named objects can be used where an 'obj' type is expected. ```CS2 lawrune ``` -------------------------------- ### Setting Event Hook with Quoted Args (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example using `cc_setonmouseover` to assign a ClientScript (`autocast_tooltip`) as a callback for a mouseover event. The ClientScript name and its arguments are provided as a single quoted string. ```CS2 Script cc_setonmouseover("autocast_tooltip($component1, $obj5)"); ``` -------------------------------- ### Graphic Literal Example in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the format for a graphic literal in CS2, representing a sprite. It is written with its name enclosed in double quotes. ```CS2 "magicoff,12" ``` -------------------------------- ### Setting Var/Skill/Inv Hook with Watch List (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example using `if_setonvartransmit` to set a callback (`deadman_tournament_hudupdate`) triggered by changes to specific variables (`var1542`, `var1293`). The watched variables are listed in braces after the ClientScript arguments. ```CS2 Script if_setonvartransmit("deadman_tournament_hudupdate(){var1542, var1293}", 90:11); ``` -------------------------------- ### Getting Array Element in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the syntax for accessing an element at a specific index ($i) within a local array ($array) in CS2. ```CS2 $array($i) ``` -------------------------------- ### Defining ClientScript Signature in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the signature format for a CS2 ClientScript. ClientScripts are typically used as callbacks for interface interactions and cannot return values. This example defines a clientscript named 'settrans' that takes a component ($component) and an integer ($trans) as arguments. ```CS2 [clientscript,settrans](component $component, int $trans) ``` -------------------------------- ### Setting Event Hook with event_ Vars (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Example using `cc_setondrag` to set a callback. It shows how special `event_` variables (`event_mousey`) can be used within the quoted ClientScript arguments; these are resolved at runtime based on the event context. ```CS2 Script cc_setondrag("scrollbar_vertical_drag($component0, $component1, event_mousey, false)"); ``` -------------------------------- ### Coord Literal Example in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the format for a coord literal in CS2, representing a tile. It consists of 5 numbers separated by underscores: plane, map-square x, map-square y, tile x within map-square, tile y within map-square. ```CS2 0_1_2_3_4 ``` -------------------------------- ### Assigning Multi-Value Return (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Shows how to assign multiple return values from an instruction or procedure call to multiple variables simultaneously. ```CS2 Script $int2, $int3 = ~poh_jewellerybox_getbuttonspacing(590:2, 3); ``` -------------------------------- ### Simple While Loop (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Shows a basic `while` loop structure to repeat a block of code 10 times. It initializes a counter `$i`, checks the condition `$i < 10`, and increments `$i` using the `calc` instruction. ```CS2 Script def_int $i = 0; while ($i < 10) { // ... $i = calc($i + 1); } ``` -------------------------------- ### Arithmetic Calculation with calc (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Demonstrates performing mathematical operations on integer expressions using the `calc` instruction. The entire expression is passed as an argument, and the result is returned. ```CS2 Script def_int $c = calc($a * $b + 2); ``` -------------------------------- ### Clamping Integer Value (CS2 Script) Source: https://github.com/runestar/cs2/blob/master/README.md Demonstrates how to use `if` and `else if` statements with relational operators (`>`, `<`) to clamp an integer variable `$n` between `$min` and `$max` values. ```CS2 Script if ($n > $max) { return($max); } else if ($n < $min) { return($min); } else { return($n); } ``` -------------------------------- ### Defining Integer Array in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the syntax for defining a local integer array in CS2. Arrays have a fixed length and elements of the same type (excluding strings). Integer elements are initialized to 0. ```CS2 def_int $array($len); ``` -------------------------------- ### Setting Array Element in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet shows the syntax for assigning a value ($n) to an element at a specific index ($i) within a local array ($array) in CS2. ```CS2 $array($i) = $n; ``` -------------------------------- ### Accessing Global Constant in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet demonstrates how to access a global constant in CS2. Global constants are defined outside scripts and cannot be modified. They are prefixed with a caret (^). ```CS2 ^iftype_rectangle ``` -------------------------------- ### Accessing Global Variable in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet demonstrates how to access a global variable in CS2. Global variables are defined outside scripts and can be used and modified within any script. They are prefixed with a percent sign (%). ```CS2 %raids_lobby_partysize ``` -------------------------------- ### Accessing Local Variable in CS2 Source: https://github.com/runestar/cs2/blob/master/README.md This snippet demonstrates how to access a local variable in CS2. Local variables are defined within a script and are only accessible there. Arguments passed to a script are also treated as local variables. They are prefixed with a dollar sign ($). ```CS2 $scrollbar ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.