Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Checking string "line break" (GER/ENG) [Re: Germanunkol] #284735
08/14/09 19:20
08/14/09 19:20
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Das schient es bei lite-C free scheinbar nicht zu geben frown

Re: Checking string "line break" (GER/ENG) [Re: Rei_Ayanami] #284742
08/14/09 19:48
08/14/09 19:48
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
WWRAP
A7.3 LC Aktiviert Zeilenumbruch für TTF-Texte. Wenn sie nicht in die Textbreite passen (size_x), werden Worte in die nächste Zeile verschoben.


einfach in den Textcode:

flags = WWRAP;


und des testen..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
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 Offline OP
Expert
Rei_Ayanami  Offline 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 frown

-------------------------------------------------------------------
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 Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
Originally Posted By: Rei_Ayanami
my strings look like this:
STRING* holograph_1_2 =
"Hey!
Sounds very cool!";

with line break wink


Originally Posted By: Quadraxas
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 wink
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 Offline OP
Expert
Rei_Ayanami  Offline 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)
Code:
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 laugh

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 Offline
Junior Member
GorNaKosh  Offline
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
Code:
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.
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1