pub trait ScriptVariableWrite: ScriptVariableRead {
    // Provided methods
    fn zero_init(&mut self, var_id: ScriptVariableId) { ... }
    fn write_raw(&mut self, value: i32) { ... }
    fn write_raw_indexed(&mut self, index: i32, value: i32) { ... }
    fn write(&mut self, value: ScriptVariableValue) { ... }
    unsafe fn write_as_scenario(&mut self, value1: u8, value2: u8) { ... }
    fn write_indexed(&mut self, index: i32, value: ScriptVariableValue) { ... }
}
Expand description

Write actions for script variables.

Provided Methods§

source

fn zero_init(&mut self, var_id: ScriptVariableId)

Zero-initialize the values of the given script variable.

source

fn write_raw(&mut self, value: i32)

Writes the given value to a script variable.

source

fn write_raw_indexed(&mut self, index: i32, value: i32)

Writes the given value to a script variable at the given index (if this is an array).

Panics if the write is out of bounds.

source

fn write(&mut self, value: ScriptVariableValue)

Writes the given value to a script variable.

If this is an array, it’s written to position 0. Special case: If the type is a string, the entire string is written. Panics if the string would overflow the array.

If the value type doesn’t match, this panics.

source

unsafe fn write_as_scenario(&mut self, value1: u8, value2: u8)

Writes to the given variable as if it were a scenario variable.

Safety

You must make sure yourself that this variable is a scenario variable. No bounds or type checking is done.

source

fn write_indexed(&mut self, index: i32, value: ScriptVariableValue)

Writes the given value to a script variable (if this is an array).

Panics if the write is out of bounds.

If the value type doesn’t match, this panics.

For string type variables, the input value must be a valid single-character CString. Only the character at the specified index is changed.

Implementors§