(→See also) |
(→See also) |
||
Line 72: | Line 72: | ||
* {{mIRC|/breplace}} | * {{mIRC|/breplace}} | ||
* {{mIRC|/btrunc}} | * {{mIRC|/btrunc}} | ||
− | |||
{{mIRC command list}} | {{mIRC command list}} | ||
[[Category:MIRC commands]] | [[Category:MIRC commands]] |
Revision as of 00:17, 6 July 2014
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
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