obj_text code
lerpprogress +=(1 - lerpprogress) / 50;
textprogress += global.textspeed;
x1 = lerp(x1,x1target,lerpprogress);
x2 = lerp(x2,x2target,lerpprogress);
//cycle through responses
keyup = keyboard_check_pressed(vk_up);
keydown = keyboard_check_pressed(vk_down);
responseselected += (keydown - keyup);
var _max = array_length_1d(responses)-1;
var _min = 0;
if (responseselected > _max) responseselected = _min;
if (responseselected < _min) responseselected = _max;
//end message
if (keyboard_check_pressed(vk_space))
{
var _messagelength = string_length(message);
if (textprogress >= _messagelength)
{
if (responses[0] != -1)
{
with(origininstance) scr_dialogueresponse(other.responsescript[other.responseselected]);
}
instance_destroy();
if (instance_exists(obj_text_queued))
{
with (obj_text_queued) ticket --;
}
else
{
with (obj_player) state = laststate;
}
}
else
{
if (textprogress > 2)
{
textprogress = _messagelength;
}
}
}
scr_new_text_box
///arg message
///arg background
/// arg[response]
var _obj;
if (instance_exists(obj_text)) _obj = obj_text_queued; else _obj = obj_text;
with ( instance_create_layer(0,0,"instances",_obj))
{
message = argument[0];
if(instance_exists(other)) origininstance = other.id else origininstance = noone;
if (argument_count > 1 ) background = argument[1]; else background = 1;
if (argument_count > 2 )
{
//trim markers from responses
responses = argument[2];
for(var i = 0; i < array_length_1d(responses); i++)
{
var _markerposition = string_pos(":",responses);
responsescript = string_copy(responses,1,_markerposition-1);
responsescript = real(responsescript);
responses = string_delete(responses,1,_markerposition);
breakpoint = 10;
}
}
else
{
responses = [-1];
responseselected = [-1];
}
}
with (obj_player)
{
if (state != scr_player_state_locked)
{
laststate = state;
state = scr_player_state_locked;
}
}