Information about object: obj_dialogue
Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code: scr_floodtexty("",0) instance_create(x+322,y+17,obj_scroll_up) instance_create(x+322,y+54,obj_scroll_down) global.playername = get_string("What is your name?","Player") //initialize scr_mb_release with all { for (i = -1; i < 4; i += 1) { press[i+1] = 0 release[i+1] = 1 press_meet[i+1] = 0 } } //set the cursor blink rate global.cursor_blink = 700 zz = 700 if zz != -1 { zz = zz/1200 zz = room_speed * zz alarm[0] = zz }
Alarm Event for alarm 0:
execute code: //this handles the cursor blinking global.cursor_blink = !global.cursor_blink alarm[0] = zz
Keyboard Event for <any key> Key:
execute code: //sets the maximum length to 75, since keyboard_string does it poorly. if string_length(keyboard_string) >= 75 { keyboard_string = string_copy(keyboard_string,1,75) }
Draw Event:
execute code: //draw_sprite(sprite_index,image_single,x,y) ///draw_text(x+17,y+17, keyboard_string) scr_drawtexty(x,y,x+sprite_width-17,y+sprite_height-17)
Key Press Event for <Enter> Key:
execute code: //this will take the text you just wrote, place word_wrap on it, and submit it if keyboard_string = "" exit kkk = string_length(global.playername+": ") scr_addline( global.playername + ": " +string_copy(keyboard_string,1,30-kkk),c_lime ) hhh = 30 while (string_length(keyboard_string)+kkk) > hhh { scr_addline( string_copy(keyboard_string,hhh-kkk+1,30), c_lime ) hhh += 30 } keyboard_string = ""
Information about object: obj_scroll_upSprite: spr_scroll_up
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: if scr_mb_release(mb_left) && obj_dialogue.current_line < (obj_dialogue.totlines-3) { obj_dialogue.current_line += 1 } if obj_dialogue.current_line >= obj_dialogue.totlines-3 { image_single = 2 } else { image_single = press_meet[mb_left+1] * position_meeting(mouse_x,mouse_y,self) }Information about object: obj_scroll_downSprite: spr_scroll_down
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectStep Event:execute code: if scr_mb_release(mb_left) && obj_dialogue.current_line>0 { obj_dialogue.current_line -= 1 } if obj_dialogue.current_line<=0 { image_single = 2 } else { image_single = press_meet[mb_left+1] * position_meeting(mouse_x,mouse_y,self) }//name = scr_floodtexty //purpose = floods texty (fills it up with the same thing) //argument0 = the text to flood the box with. //An empty string clears the box //argument1 = the color to flood the box with. totlines = 0 current_line = 0 for (m = 0; m < 10 ; m += 1) { global.texty[m] = argument0 global.textcol[m] = argument1 }//define the corner locations left = argument0 top = argument1 right = argument2 bottom = argument3 //draw the chat boxes //draw_set_font(courier) draw_set_halign(fa_left) draw_set_color(c_blue) draw_rectangle(left,top,right,bottom-24,1) draw_rectangle(left,bottom-24,right,bottom,1) //draw the chat draw_set_color(c_lime) if global.cursor_blink { draw_text( left+4, bottom-23, string_copy( keyboard_string +"|", string_length(keyboard_string)-30, string_length(keyboard_string +"|") ) ) } else { draw_text( left+4, bottom-23, string_copy( keyboard_string, string_length(keyboard_string)-30, string_length(keyboard_string) ) ) } for (t=2; t>-1; t-=1) { draw_set_color(global.textcol[current_line+t]) draw_text(left+4,top-13+((3-t)*16),global.texty[current_line+t]) }
No comments:
Post a Comment