Advertisement
Guest User

sddgfs

a guest
Dec 30th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // CREATE EVENT:
  3.  
  4. message[0] = "...Sorry, Kid. You can't get in unless you get vouched for.";
  5. message[1] = "TEST TEST";
  6.  
  7. message_current = 0;
  8. timer = 0;
  9. cutoff = 0;
  10. t = 0;
  11. increment = 1;
  12.  
  13. done = false;
  14.  
  15. -----
  16. // DRAW GUI EVENT:
  17.  
  18. draw_set_font(f_dialogue);
  19. draw_set_colour(c_white);
  20. draw_set_halign(fa_center);
  21.  
  22. message_end = array_length_1d(message);
  23.  
  24. if (message_end > 0)
  25. {
  26.     var charWidth = 30;
  27.     var lineEnd = 55;
  28.     var line = 0;
  29.     var space = 0;
  30.     var i = 1;
  31.     var delay = 3;
  32.    
  33.     tX = (room_width / 2.0);
  34.     tY = view_hview[0]-730;
  35.    
  36.     if (keyboard_check_pressed(vk_enter))
  37.     {
  38.         if (message_current < message_end-1)
  39.         {
  40.             message_current++;
  41.             cutoff = 0;
  42.         }
  43.        
  44.         else
  45.         {
  46.             done = true;
  47.         }
  48.        
  49.    
  50.     }
  51.    
  52.     if (cutoff < string_length(message[message_current]))
  53.     {
  54.         if (timer >= delay)
  55.         {
  56.             cutoff++;
  57.             timer = 0;
  58.         }
  59.         else timer++;
  60.     }
  61.    
  62.     while(i <= string_length(message[message_current]) && i <= cutoff)
  63.     {
  64.         var length = 0;
  65.         while (string_char_at(message[message_current], i) != " " && i <= string_length(message[message_current]))
  66.         {
  67.             i++;
  68.             length++;
  69.         }
  70.        
  71.         if (space+length > lineEnd)
  72.         {
  73.             space = 0;
  74.             line++;
  75.         }
  76.        
  77.         i-= length;
  78.        
  79.         draw_text(tX+(space*charWidth), tY+(50*line), string_char_at(message[message_current], i));
  80.        
  81.         space++;
  82.         i++;
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement