Page 1 of 1

Passing strings between actors.

PostPosted: Fri Mar 26, 2004 9:11 am
by jazz_e_bob
I have an actor - redZombie.

I have defined a local string for actors called creator.

When my redZombie is created it runs the script:

CreateActor("redZombieBase", "base", "no parent", "no path", 0, 0, false);

How do I pass the name "redZombie" to the base actor?

ie

redZombieBase.creator = name;

PostPosted: Sat Mar 27, 2004 1:53 am
by makslane
Use this:

Actor *newActor = CreateActor("redZombieBase", "base", "no parent", "no path", 0, 0, false);


strcpy(newActor->creator, "redZombie");

PostPosted: Sat Mar 27, 2004 2:24 am
by jazz_e_bob
Thanks mate!

:)

Image

PostPosted: Sat Mar 27, 2004 6:18 am
by jazz_e_bob
This works:

Actor *newActor = CreateActor("redZombieBase", "base", "no parent", "no path", 0, 0, false);
strcpy(newActor->creator, "redZombie");

How come:

newActor.mylocalvar = 100;

doesn't work?

:oops:

PostPosted: Sat Mar 27, 2004 8:30 pm
by makslane
Try this:

newActor->mylocalvar = 100;

PostPosted: Sat Mar 27, 2004 8:57 pm
by jazz_e_bob
Will do.

Thanks Makslane.

PostPosted: Sun Mar 28, 2004 11:19 pm
by jazz_e_bob
Heh heh :)

How about:

debug_02->text = name;

( error - pointer required )

How do I make this work?

PostPosted: Mon Mar 29, 2004 1:41 pm
by makslane
strcpy(debug_02->text, name);