Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
printing text from a txt in wdl's #268937
05/31/09 20:52
05/31/09 20:52
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18
right now I already made all the connections and I can load text into the program from an exturnal txt file. I can also print these in a panel with the TEXT object.

but my problem is I can only print 1 line. and moost of the time I need to print 5 or more.

I found this function to help me get more strings to the screen.

txt_addstring(text,stest);

here:
text is the text object
and stest is the string

but the code keaps saying that it doesn't know the function, could it be the function name got changed? or am I doing somthing wrong?

do note that I found the function in the online manual.

Last edited by FlyingRaven; 05/31/09 20:52.
Re: printing text from a txt in wdl's [Re: FlyingRaven] #269114
06/01/09 21:00
06/01/09 21:00
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18
come on people some one must know how to print out multiple strings using just one text object.

Re: printing text from a txt in wdl's [Re: FlyingRaven] #269133
06/01/09 22:35
06/01/09 22:35
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Code:
// legacy usage
// var temp[3];
TEXT txt {
	//font = ?;
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	strings = 32;
	flags = VISIBLE;
}

function main() {
	// load STRINGs from file
	temp.x = txt_load(txt, "file.txt");
	// temp.x is number of STRINGs loaded
	// access nth STRING, last STRING
	temp.y = str_len(txt.string[temp.x -1]);
	// temp.y = str_len((txt.pstring)[n]);
}


Re: printing text from a txt in wdl's [Re: testDummy] #269397
06/02/09 22:59
06/02/09 22:59
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18
Originally Posted By: testDummy
Code:
// legacy usage
// var temp[3];
TEXT txt {
	//font = ?;
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	strings = 32;
	flags = VISIBLE;
}

function main() {
	// load STRINGs from file
	temp.x = txt_load(txt, "file.txt");
	// temp.x is number of STRINGs loaded
	// access nth STRING, last STRING
	temp.y = str_len(txt.string[temp.x -1]);
	// temp.y = str_len((txt.pstring)[n]);
}


thank you this already really helped me. but I was wondering.
if it posible just to extract a specific amount of lines.
since I have a program that looks fore a answer to the asked question and then the answer must be printed onto the screen.

I have been trying to do this with the code you gave me but it's just printing everything no mather what I do.

Re: printing text from a txt in wdl's [Re: FlyingRaven] #269414
06/03/09 01:28
06/03/09 01:28
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Relevant, digestible, manageable, practical, reasonable or not, it should be possible to load text from file into a non-VISIBLE TEXT, and show n lines from that in a VISIBLE TEXT, via something similar to str_cpy(tShown.string[j], tHidden.string[i]).

Note: Functions txt_setvisible, txt_setinvisible, might be A7 Lite-C only.


Re: printing text from a txt in wdl's [Re: testDummy] #269422
06/03/09 02:45
06/03/09 02:45
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Like testDummy said, something like this.
(Untested, as I dont really know c-script)

Code:
// legacy usage
// var temp[3];
TEXT txt {
	//font = ?;
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	strings = 32;
	flags = VISIBLE;
}

TEXT txt_buffer {  strings = 255;  }  //this IS invisible


function main() {
	temp.x = txt_load(txt_buffer, "file.txt");        // load STRINGs from file
	// temp.x is number of STRINGs loaded
	//
	temp.y = str_len(txt_buffer.string[temp.x -1]);   // access nth STRING, last STRING
	//
	//  copy first 5 lines to the screen
	temp.z = 0;
	while(temp.z < 5)
	{
		str_cpy(txt.string[temp.z], txt_buffer.string[temp.z]);
		//or str_cpy((txt.string)[temp.z], (txt_buffer.string)[temp.z]);
		temp.z = temp.z + 1;
	}
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: printing text from a txt in wdl's [Re: EvilSOB] #269629
06/03/09 20:27
06/03/09 20:27
Joined: Apr 2009
Posts: 18
F
FlyingRaven Offline OP
Newbie
FlyingRaven  Offline OP
Newbie
F

Joined: Apr 2009
Posts: 18
Originally Posted By: testDummy
Relevant, digestible, manageable, practical, reasonable or not, it should be possible to load text from file into a non-VISIBLE TEXT, and show n lines from that in a VISIBLE TEXT, via something similar to str_cpy(tShown.string[j], tHidden.string[i]).

Note: Functions txt_setvisible, txt_setinvisible, might be A7 Lite-C only.


Originally Posted By: EvilSOB
Like testDummy said, something like this.
(Untested, as I dont really know c-script)

Code:
// legacy usage
// var temp[3];
TEXT txt {
	//font = ?;
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	strings = 32;
	flags = VISIBLE;
}

TEXT txt_buffer {  strings = 255;  }  //this IS invisible


function main() {
	temp.x = txt_load(txt_buffer, "file.txt");        // load STRINGs from file
	// temp.x is number of STRINGs loaded
	//
	temp.y = str_len(txt_buffer.string[temp.x -1]);   // access nth STRING, last STRING
	//
	//  copy first 5 lines to the screen
	temp.z = 0;
	while(temp.z < 5)
	{
		str_cpy(txt.string[temp.z], txt_buffer.string[temp.z]);
		//or str_cpy((txt.string)[temp.z], (txt_buffer.string)[temp.z]);
		temp.z = temp.z + 1;
	}
}


Thanks guys what you guys said really helped a bunch. and now I can finaly print specific text. I have been looking trough the manual fore a long long time now but I just didn't find the moost things you mentioned here.

so I thank you guys from the bothem of my heart


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

Gamestudio download | 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