obj_message
create_event
global.message=ds_list_create();//create a ds list to hold messages
can_show=true;//set that a message can show
to_draw="";//set text to draw to ""
alarm 0 event
///alarm0 set alarm1
alarm[1]=room_speed*1;//create a short pause
to_draw="";//remove text to show
alarm 1 event:
///set as able to show
can_show=true;//allow message to show
step event:
///check if message waiting
check=ds_list_size(global.message);//get no of messages waiting
if check>0 && can_show//do this if more than one message and can show
{
to_draw=ds_list_find_value(global.message,0);//get message from top of ds list
ds_list_delete(global.message,0);//delete this message
can_show=false;//prevent showing
alarm[0]=room_speed*4;//create a pause
}
draw event:
///draw message
if to_draw!=""//do if there is a message waiting
{
//draw a background box
draw_set_colour(c_blue);
draw_rectangle(100,280,700,320,false);
//draw a message
draw_set_font(font_message);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_colour(c_red);
draw_text(400+1,300+1,to_draw);
draw_set_colour(c_white);
draw_text(400,300,to_draw);
}
obj_player
release event:
//choose an example message and sent to scriptmessage=choose("this is a message","this another message","this is yet another message");
scr_message(message);
scr_message
//add message to a ds list
ds_list_add(global.message,argument0);
No comments:
Post a Comment