Passing strings between actors.

Non-platform specific questions.

Passing strings between actors.

Postby jazz_e_bob » Fri Mar 26, 2004 9:11 am

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;
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Sat Mar 27, 2004 1:53 am

Use this:

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


strcpy(newActor->creator, "redZombie");
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jazz_e_bob » Sat Mar 27, 2004 2:24 am

Thanks mate!

:)

Image
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Sat Mar 27, 2004 6:18 am

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:
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Sat Mar 27, 2004 8:30 pm

Try this:

newActor->mylocalvar = 100;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jazz_e_bob » Sat Mar 27, 2004 8:57 pm

Will do.

Thanks Makslane.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Sun Mar 28, 2004 11:19 pm

Heh heh :)

How about:

debug_02->text = name;

( error - pointer required )

How do I make this work?
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Mon Mar 29, 2004 1:41 pm

strcpy(debug_02->text, name);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest