A "Get Actor by Name" block

Blacksmith

  • Posts: 142
As Rob1221 pointed out to me we have a Get Scene by Name block. So why not have a Get Actor by Name block too?

Blacksmith

  • Posts: 142
Captaincomic pointed out that:
Quote
There's no block for getting actors like that. You can do it with code, but actors have to be referred by ID, not by name. Only Actor Types can be referred by name.

With that information, I guess the blocks I'm suggesting are:
Get Actor Type
Get Actor ID

thanks.

Justin

  • *
  • Posts: 4583
If you want an actual "get actor by name" block, search for "Actor Identifier" on Forge.

No seriously, do it. Not enough people are using it. And then if it doesn't do what you need... feel free to bug me about it?
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Fiendish

  • Posts: 12
In other programs, you can call Actors by name and I think it is more than a fair request and should be a strong candidate for implementation for ease of use in the future.

As the OP said we can get scenes by name.

Unless I am wrong, Actor Identifier though useful, is limited in this case as it lets you name Actor Types and not instances of Actors.

I like to create Actors on a scene at runtime and it would be great if I could just tag each one with a Name at creation for messaging later.

I know ID's are for internal use, but Actors (not just Actor Types)also have a Name, and a block that works with that would be a Huge benefit.

« Last Edit: April 11, 2013, 02:49:42 pm by Fiendish »

Justin

  • *
  • Posts: 4583
Quote
I like to create Actors on a scene at runtime and it would be great if I could just tag each one with a Name at creation for messaging later.
Yes, this is exactly what Actor Identifier allows you to do.

You can name an actor through:
- The Actor Type settings (though that wouldn't be worth a whole lot)
- Instance Customization in the Scene Editor, or
- At runtime, after you've created the actor, using the built in blocks.

I won't argue whether or not we should have something like that built in. Actor Identifier is a good temporary measure though.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

dripple

  • Posts: 748
Hi, sorry for dropping in. I have the same problem (I want to iterate over a number of actors to change the values) and would like to check the Actor Identifier, but I can't find it on Stencyl Forge?

(At the moment, I have setup Actor Groups and a Actor Behaviours which works for me in this case, but I feel, I need a better solution)

« Last Edit: May 04, 2013, 12:58:34 pm by dripple »
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

Justin

  • *
  • Posts: 4583
Are you using Stencyl 3? The behavior was previously pre-3.x only. I've just shared a 3.0 version.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

dripple

  • Posts: 748
Thanks, Justin.

I will try out later.
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

davidvonallmen

  • Posts: 34
Adding my support for this idea because it is exactly the problem I'm running into right now.

Justin, will try your code - thank you for putting it up on Forge!

spinnerbox

  • Posts: 166
I think this should be a feature in stencyl, listing trough a list of actors by their names/IDs.
I wanted to create several actors using a loop block but I couldn't.

I will check stencyl 3.

gamegirlxl

  • Posts: 713
You might be able to create a list/array of actors, and search that list or something.

Also, I have experience with loops of loops, which might be helpful.  I have one attribute per loop wrapper, placed as the first thing within.  It works, but I used it for drawing stuff, where you have VERY few options with what you can do.

dripple

  • Posts: 748
Are you using Stencyl 3? The behavior was previously pre-3.x only. I've just shared a 3.0 version.

 Hi Justin. You might want to update the behavior since Hash is no longer supported in Haxe. I changed the static var declaration to:
Code: [Select]
public static var namedActors = new Map();
Sure, my games won't get better with all the new features of Stencyl.
But I do have more fun creating bad ones.


MayazCastle Keeper

DCameron

  • Posts: 63
I get this error:
Actor Identifier (77) -  Missing ;

Even if I attach this to an actor and give the actor Identifier an actor instance name, I still get this error. Any ideas where I'm going wrong?
Artist for hire: http://community.stencyl.com/index.php/topic,49739.0.html

Play my games on Kongregate:                                     Get updates on my Patreon page: