You are not logged in.
Pages: 1
Couldn't find a script that did this, so I wrote my own.
Example project can be downloaded from SendSpace here.
/// string_wrap(str, width)
//
// Returns the string formatted with automatic linebreaks based on the width
// Words too long to fit into a line are also given a linebreak
//
// str the string to format, string
// width width of the formatted string, real
//
/// GMLscripts.com/license
{
var str = argument0, width = argument1, cur_word = "", saved_pos = 1;
for (var i = 1; i <= string_length(str); i++) {
cur_word += string_char_at(str, i);
if (string_char_at(str, i) == " " || i == string_length(str)) {
if (string_width(string_copy(str, 1, i)) >= width) {
str = string_insert("#", str, saved_pos);
str = string_delete(str, saved_pos + 1, 1);
}
saved_pos = i;
cur_word = "";
}
if (string_width(cur_word) >= width) {
str = string_insert("#", str, i);
cur_word = "";
}
}
return str;
}
Offline
Thanks for the submission.
There is a similar script here: http://www.gmlscripts.com/script/string_wordwrap
We'll have to see how they compare.
Abusing forum power since 1986.
Offline
Pages: 1