Ho creato due script uno serve per andare a capo e l'altro per disegnare la chat.
script per andare a capo:
Codice: Seleziona tutto
//argument0..Testo.
//argument1..Lunghezza massima.
var testo="";
if string_length(argument0)>argument1{
testo=string_insert("#",argument0,argument1);
return testo;
}else return argument0;
Codice: Seleziona tutto
ult_mex=ds_list_size(global.chat);
ult_nick=ds_list_size(global.nick);
ult_ora=ds_list_size(global.ora);
ult10_mex=(ult_mex-argument0)
draw_set_colour(c_white)
if global.stato_chat=1{//chat aperta
for(i=ult10_mex; i<ult_mex;i+=1){
if is_undefined(ds_list_find_value(global.chat,i))=false{
str=global.ora[| i]+" "+global.nick[| i]+":"+global.chat[| i]
testo=a_capo_auto(str,50)
if string_length(testo)>50{draw_text(10, 10 + (10*(i-ult10_mex)*3),testo)}
else if string_length(testo)<50{draw_text(10, 10 + (10*(i-ult10_mex)*3),testo)}
}
}
}
//chat chiusa
else if global.stato_chat=0{
if is_undefined(global.chat[|global.tot_mex])=false{
draw_text(10, 10, global.ora[| global.tot_mex]+" "+global.nick[| global.tot_mex]+":"+global.chat[| global.tot_mex]);
}
}
mex1:aaaaaaa
mex2:aaaa
mex3:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
mex4:aaaa
mex5:aaa
Solo il mex3 e il mex4 vengo drawati correttamente, ho provato in vari modi ad eliminare gli spazzi o per non far accavallare il testo, cosa sbaglio?