// The input string - you would need to get this from the player using a get_string_async() for example
var _input_string = "obj_player.spd=10";
// Extract the object name as a string and convert to object_index
// NOTE : Preferably you would provide the player with a list of instances in your game to choose first, in
// which case you wouldn't need to use asset_get_index to retrieve the object_id, this
// example is just a quick mock up and would only work properly if there is just one instance of obj_player in
// the room.
var _object_name_end_pos = string_pos(".", input_string);
var _inst_name = string_copy(_input_string, 1, _object_name_end_pos - 1);
var _inst_id = asset_get_index(_inst_name);
// Extract the variable name from the string
var _variable_name_end_pos = string_pos("=", _input_string);
var _variable_name_length = _variable_name_end_pos - _object_name_end_pos;
var _variable_name = string_copy(_input_string, _object_name_end_pos + 1, _variable_name_length);
// Extract the value from the string. (Assuming its meant to be a real - the final version you
// would need to add some checks, like if the player put quotation marks around the value
// then read it as a string.
var _value_length = string_length(_input_string) - _variable_name_end_pos;
var _value = real(string_copy(_input_string, _variable_name_end_pos + 1, _value_length);
// Check if the obj_player actually has a variable with the name given, and if so, set it to the value.
if ( variable_instance_exists(_inst_id, _variable_name) )
{
variable_instance_set(_inst_id, _variable_name, _value);
}