Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///scr_linebreak(string,maxLength,maxWordLength)
- //Takes a string and automatically inserts linebreaks into it after a certain amount of characters.
- //string = string to automatically linebreak
- //maxLength = maximum length a line can be before breaking
- //maxWordLength = maximum length a word can be before the script gives up and starts a new line
- //Created by Spasman
- //spasman@spasmangames.com
- //Modified a little bit from the original code
- insert = 0
- go = 0
- count = 0
- text = argument0
- count_ignore = 0
- repeat(string_length(text)) {
- if insert > argument1 {
- while(1) {
- str = string_char_at(text,go-count)
- if str = "["
- {
- count_ignore = 1
- }
- if str = "]"
- {
- count_ignore = 0
- }
- if str != " " and count_ignore = 0
- {
- count += 1
- }
- else
- {
- break;
- }
- if count > argument2 {
- count = 0
- break;
- }
- }
- text = string_insert("#",text,go-count)
- insert = 0
- }
- insert += 1
- go += 1
- if string_char_at(text,go) = "#" {
- insert = 0
- }
- }
- show_debug_message(text)
- return text;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement