Edit - fixed, and it has now been tested and works.
I don't know if anyone has done this, but I've re-created the old draw_text_sprite(). It does exactly what the old function did except for if the line is longer than w and contains no spaces or "-"... in that case it inserts a newline at the next possible space or "-" (I'm not sure if that's what the original function did).
This uses registered functions so it won't work on Lite for PC...
/* draw_text_sprite(x,y,string,sep,w,sprite,firstchar,scale) */
var current_width,current_height,newline,a,b,c;
current_width = 0;
current_height = 0;
newline = chr(13);
argument2 = string_replace_all(argument2,"\#","73tgdjsosu3");
argument2 = string_replace_all(argument2,"#",newline);
argument2 = string_replace_all(argument2,"73tgdjsosu3","#");
argument2 = string_replace_all(argument2,chr(13),newline);
argument2 = string_replace_all(argument2,chr(10),newline);
if(argument4==-1){
argument4 = sprite_get_width(argument5)*(string_length(argument2) + string_count(newline,argument2));
}
if(string_length(argument2)>(argument4 div (sprite_get_width(argument5)*argument7))){
for(a=(argument4 div (sprite_get_width(argument5)*argument7))+1;a<=string_length(argument2);a+=(argument4 div (sprite_get_width(argument5)*argument7))){
for(b=0;b<=(argument4 div (sprite_get_width(argument5)*argument7));b+=1){
if(string_char_at(argument2,a-b)==" "){
argument2 = string_copy(argument2,1,a-b-1)+newline+string_copy(argument2,a-b+1,string_length(argument2));
a=a-b+1;
break;
}
else if(string_char_at(argument2,a-b-1)=="-"){
argument2 = string_copy(argument2,1,a-b-1)+newline+string_copy(argument2,a-b,string_length(argument2));
a=a-b;
break;
}
if(b==(argument4 div (sprite_get_width(argument5)*argument7))){
for(c=1;a+c<string_length(argument2);c+=1){
if(string_char_at(argument2,a+c)==newline){
break;
}
else if(string_char_at(argument2,a+c)==" "){
argument2 = string_copy(argument2,1,a+c-1)+newline+string_copy(argument2,a+c+1,string_length(argument2));
a = a+c+1;
break;
}
else if(string_char_at(argument2,a+c)=="-"){
argument2 = string_copy(argument2,1,a+c)+newline+string_copy(argument2,a+c+1,string_length(argument2));
a = a+c+1;
break;
}
}
}
}
}
}
for(a=1;a<=string_length(argument2);a+=1){
if(string_char_at(argument2,a)!=newline){
draw_sprite_ext(argument5,ord(string_char_at(argument2,a))-ord(argument6),argument0+current_width,argument1+current_height,argument7,argument7,0,c_white,1);
current_width+=sprite_get_width(argument5)*argument7;
}
else{
current_width = 0;
current_height+=sprite_get_height(argument5)*argument7 + argument3;
}
}
Edited by dannyjenn, 28 June 2012 - 02:09 AM.











