Advertisement
Guest User

Untitled

a guest
Feb 17th, 2017
113
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.  
  8. //Modified a little bit from the original code
  9.  
  10. insert = 0
  11. go = 0
  12. count = 0
  13. text = argument0
  14. count_ignore = 0
  15.  
  16. repeat(string_length(text)) {
  17. if insert > argument1 {
  18. while(1) {
  19. str = string_char_at(text,go-count)
  20.  
  21. if str = "["
  22. {
  23. count_ignore = 1
  24. }
  25.  
  26. if str = "]"
  27. {
  28. count_ignore = 0
  29. }
  30.  
  31. if str != " " and count_ignore = 0
  32. {
  33. count += 1
  34. }
  35.  
  36. else
  37. {
  38. break;
  39. }
  40.  
  41.  
  42. if count > argument2 {
  43. count = 0
  44. break;
  45. }
  46. }
  47. text = string_insert("#",text,go-count)
  48. insert = 0
  49. }
  50. insert += 1
  51. go += 1
  52. if string_char_at(text,go) = "#" {
  53. insert = 0
  54. }
  55. }
  56.  
  57. show_debug_message(text)
  58. return text;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement