2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
printing text from a txt in wdl's
#268937
05/31/09 20:52
05/31/09 20:52
|
Joined: Apr 2009
Posts: 18
FlyingRaven
OP
Newbie
|
OP
Newbie
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]
#269133
06/01/09 22:35
06/01/09 22:35
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
// 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
FlyingRaven
OP
Newbie
|
OP
Newbie
Joined: Apr 2009
Posts: 18
|
// 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
testDummy
Serious User
|
Serious User
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
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Like testDummy said, something like this. (Untested, as I dont really know c-script)
// 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
FlyingRaven
OP
Newbie
|
OP
Newbie
Joined: Apr 2009
Posts: 18
|
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. Like testDummy said, something like this. (Untested, as I dont really know c-script)
// 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
|
|
|
|