|
3 registered members (TipmyPip, AndrewAMD, Quad),
5,623
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Checking string "line break" (GER/ENG)
[Re: Espér]
#289354
09/12/09 09:51
09/12/09 09:51
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
Also WWRAP bringt mir nichts... - da ich es ehr für size_y bräuchte Und anderes habe ich keine Ahunung  ------------------------------------------------------------------- WWARP doesn´t help me - because i´d need size_y and i don´t know what to do else
|
|
|
Re: Checking string "line break" (GER/ENG)
[Re: Rei_Ayanami]
#289367
09/12/09 12:07
09/12/09 12:07
|
Joined: Feb 2009
Posts: 84 Deutschland/Niedersachsen
GorNaKosh
Junior Member
|
Junior Member
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
|
my strings look like this: STRING* holograph_1_2 = "Hey! Sounds very cool!"; with line break whitespace is not linebreak, you cannot check it. If you would use '\n' for linebreaks in your string, it would be possible, because this linebreaks could be found with str_stri() ... just a suggestion, hopes this helps  Gor Na Kosh EDIT: An other possibility could be to convert the string into single characters and check their ASCII value width str_to_asc() a linebreak would be 13 + 10 if I'm right
Last edited by GorNaKosh; 09/12/09 12:15.
|
|
|
Re: Checking string "line break" (GER/ENG)
[Re: GorNaKosh]
#289392
09/12/09 16:17
09/12/09 16:17
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
Habe ich probiert, doch leider wurde der "/n" in jeder zeile immer um 2 zeichen zu früh erkannt(und das immer früher - also 1. Zeile - richtig erkannt 2. Zeile - 2 Zeichen zu früh 3. Zeile - 4 Zeichen zu früh und so weiter das kam mit diesem Code(PS: der text soll gleichtzeitig wie getippt aussehen)
function show_hologramm_txt() //für das Zeigen des Hologramm Textes
{
var i, j = 0, cursor_pos = 0; //2 lokale variablen
var face_per;
var lines = 0, clip_lines = 0, trunc_lines = 0;
if(hologramm == 1)
{
text_pan.pos_x = screen_size.x - bmap_width(text_pan_back)*screen_size.x/1680;
text_pan.scale_x = screen_size.x/1680;
text_pan.scale_y = screen_size.y/1050;
while(text_pan.alpha < 100)
{
text_pan.alpha += 5 *time_step;
wait(1);
}
holograph_1_txt.pos_x = text_pan.pos_x + 20;
holograph_1_txt.pos_y = text_pan.pos_y + 20;
face_ent.flags2 |= SHOW;
str_cpy(text_str, holograph_1_1);
str_cpy(temp_str, text_str);
i = str_len(text_str);
str_trunc(text_str, i);
set(holograph_1_txt, SHOW);
while(i > 0)
{
if(random(10) > 5) face_per += 50 * time_step;
else face_per = 0;
ent_animate(face_ent, "talk", face_per, ANM_CYCLE);
str_cpy(text_str, temp_str);
str_trunc(text_str, i);
cursor_pos++;
i--;
// if((str_stri(temp2_str, n_str) == cursor_pos))
// {
// printf("Number: %3.0f", (double)cursor_pos);
// lines++;
// clip_lines = str_stri(temp2_str, n_str);
// printf("Lines: %3.0f", (double)lines);
// cursor_pos = 0;
// }
str_cpy(temp2_str, temp_str);
str_clip(temp2_str, clip_lines)
if(str_stri(temp2_str, n_str) > 0)
{
lines++;
printf("lines : %3.0f", (double)
clip_lines = str_stri(temp2_str, n_str)+2;
}
str_cpy (temp2_str, temp_str);
if(lines >= 3)
{
trunc_lines = str_stri(temp2_str, n_str);
}
wait(-0.05);
}
.......
-- kannst du das andere mal erklären 
|
|
|
Re: Checking string "line break" (GER/ENG)
[Re: Rei_Ayanami]
#289412
09/12/09 18:02
09/12/09 18:02
|
Joined: Feb 2009
Posts: 84 Deutschland/Niedersachsen
GorNaKosh
Junior Member
|
Junior Member
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
|
puh Oo um das nachzuvollziehen gib uns mal was vollständiges. Wo sind denn die ganzen String mit denen du da rumbastelst definiert und was hat es mit der cursor_pos auf sich? Ich komm immer noch nicht ganz dahinter was du eig genau machen willst^^ str_to_asc() gibt den ASCII Wert eines Zeichens zurück http://www.tcp-ip-info.de/tcp_ip_und_internet/ascii.htm
var temp = str_to_asc("A"); //temp == 65
also könntest du alle Zeichen deines Strings überprüfen, denn auch der whitespace hat bestimmt einen ASCII-Wert (Zeilenumbruch war 13+10 glaub ich)
Last edited by GorNaKosh; 09/12/09 18:04.
|
|
|
|