SetByte

(Engine-Level Function)

Description: Writes a single byte to a buffer.
Returns: Nothing
Usage: Script Only.
Function Groups: String and Buffer
Related to: GetByte | MakeBuff
Format: SetByte(Buffer, Offset, Value)
Parameters:  
Buffer
Required. Any buffer expression giving the buffer to set. This buffer must already exist. It could be created by a function such as MakeBuff, or by assignment of a text constant.
Offset
Required. Any numeric expression giving the offset from the start of the buffer in bytes, starting from 0.
Value
Required. Any numeric expression giving the byte value to write at Offset bytes from the beginning of Buffer.
Comments: This statement may only appear in a script.

Example:

msg = "ABCDEF";
If MatchKeys(2, "g");
[
  SetByte(msg, 1, 65);
]

The value of msg will be "AACDEF" when the user presses "g" on the keyboard.