m (Bot: de-linking old mIRC menu) |
(→Switches) |
||
Line 11: | Line 11: | ||
* '''-t''' - Indicates a string is to be written instead of literal ASCII values | * '''-t''' - Indicates a string is to be written instead of literal ASCII values | ||
* '''-c''' - Fills the binary variable with the string/ASCII values and truncates anything after it | * '''-c''' - Fills the binary variable with the string/ASCII values and truncates anything after it | ||
+ | * '''-a''' - Don't apply UTF-8 encoding to characters in the range 0-255, as long as the line contains no characters > 255. | ||
== Parameters == | == Parameters == |
Revision as of 21:26, 13 August 2017
The /bset command lets you assign specific ASCII values (or text) at a specific position. If the variable does not exists, a new binary variable will be created and zero-pad until <pos>. If <pos> exceeds the length of the variable, the variable will extend (by zero-padding the gap) to accommodate the new values.
Note: Important fact to remember about binary variables is that they are not limited to the local scope of the alias but instead they remain set until processing is complete. Thus it's possible to use the same binary variable within multiple aliases if they call each other during the same script execution.
Synopsis
/bset -c <&bvar> <pos> <asciivalue> [asciivalue ... asciivalue] /bset -tc <&bvar> <pos> <string>
Switches
- -t - Indicates a string is to be written instead of literal ASCII values
- -c - Fills the binary variable with the string/ASCII values and truncates anything after it
- -a - Don't apply UTF-8 encoding to characters in the range 0-255, as long as the line contains no characters > 255.
Parameters
- <&bvar> - The binary variable name to use/create
- <pos> - The position to set the new ASCII values or the string
- <asciivalue> - ASCII value to write
- [asciivalue ... asciivalue] - Succeeding ASCII values to be written
- <string> - The string to be written
Example
Alias Example { ;Create a binary variable set it to "This is fun!" bset -t &Example 1 This is fun! ;Print out the content of the variable echo -a $bvar(&Example, 1-).text }
Binary variables have the advantage that they can be accessed from anywhere during the script execution.
Alias Example { ;Create a binary variable bset -t &Example 1 Hello There Bob. bb } Alias bb { ; Override that last part and truncate it bset -tc &Example 7 Stranger! cc } Alias cc { ; print the value echo -a $bvar(&Example, 1-).text }
This example shows how the variable gets zero-padded if <pos> is outside the size of the variable:
Alias Example { ; put 'd' as the 5th byte in &var bset &var 5 100 ; will print: 0 0 0 0 100 echo -a $bvar(&var, 1-) ; zero-pad bytes 6-9 bset &var 9 0 ; will print: 0 0 0 0 100 0 0 0 0 echo -a $bvar(&var, 1-) }
Compatibility
Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.