Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. ///scr_linebreak(string,maxLength,maxWordLength)
  2. //Takes a string and automatically inserts linebreaks into it after a certain amount of characters.
  3. //string = string to automatically linebreak
  4. //maxLength = maximum length a line can be before breaking
  5. //maxWordLength = maximum length a word can be before the script gives up and starts a new line
  6. //Created by Spasman
  7. //spasman@spasmangames.com
  8.  
  9. //Modified a little bit from the original code
  10.  
  11. insert = 0
  12. go = 0
  13. count = 0
  14. text = argument0
  15. count_ignore = 0
  16.  
  17. repeat(string_length(text)) {
  18. if insert > argument1 {
  19. while(1) {
  20. str = string_char_at(text,go-count)
  21.  
  22. if str = "["
  23. {
  24. count_ignore = 1
  25. }
  26.  
  27. if str = "]"
  28. {
  29. count_ignore = 0
  30. }
  31.  
  32. if str != " " and count_ignore = 0
  33. {
  34. count += 1
  35. }
  36.  
  37. else
  38. {
  39. break;
  40. }
  41.  
  42.  
  43. if count > argument2 {
  44. count = 0
  45. break;
  46. }
  47. }
  48. text = string_insert("#",text,go-count)
  49. insert = 0
  50. }
  51. insert += 1
  52. go += 1
  53. if string_char_at(text,go) = "#" {
  54. insert = 0
  55. }
  56. }
  57.  
  58. show_debug_message(text)
  59. return text;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement