Strcpy in global code?

Non-platform specific questions.

Strcpy in global code?

Postby Novice » Thu Jun 08, 2006 6:01 pm

Hi,
im trying to make a function that uses strcpy to display text on a text actor, but for some reason it refuses to work :? . So i shoretened it to a minimum, but it still wont work. I've tried every type of function but it's all the same. It seems that strcpy wont work from global script editor to display text.
Code: Select all
void say()
{
strcpy(txt.text, "Hello");
}

and
Code: Select all
char *say()
{
  strcpy(txt.text, "hello");

 return NULL;
}

and other things.
Can someone tell me the right syntax for this, i've read all topics containing "strcpy" but no luck.
TIA
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby makslane » Thu Jun 08, 2006 6:11 pm

The problem is nor strcpy, but you try change actors variables in a global code. To works, you need put some reference to used actors in the caller script. If you are using the txt actor, you need use this actor in the caller script, evn in a comment, like this:

//txt <- Your reference
say();
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Novice » Thu Jun 08, 2006 7:21 pm

Thanks it works perfectly! :mrgreen:
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest