line copy function, allows you to copy a selected line....

You must understand the Game Editor concepts, before post here.

line copy function, allows you to copy a selected line....

Postby Sgt. Sparky » Tue Jun 12, 2007 12:14 am

here is a line copy function, allows you to copy a selected line from a selected actors text,
to use this, put this code in global code:
Code: Select all
void linecopy(int b, char a[255])
{
int i, line_pos, i2, Num;
line_pos = 0;
i2 = 0;
Num = 0;
i = 0;
strcpy(text, "");
for(i = 0; i <= strlen(a); i++)
{
    if(line_pos == b - 1)Num = i;
    if(strncmp(&a[i], "\n", 1) == 0)line_pos++;
    if(line_pos == b)i2 = i;
}
i = Num;
for(i = Num; i <= i2; i++)
{
    strncpy(temp, &a[i], 1);
    strcat(text, temp);
}
}

now for copying after you add this to global code put this on any event for a text actor,
linecopy(theline, soandso.text);
or to do this litterally:
if I want to copy line 5 from an actor called myactor,
linecopy(4, myactor.text);
remember, 0 is the first line, 1 is the second, and so on. :D
you can also copy from varables, like a variable called myvar, that is string, and global on line 5,
linecopy(4, myvar);
it is just like using strcpy. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest