Registering actor with GlobalActorID.set

DinaCardillo

  • Posts: 3
Hi! I'm having trouble figuring out how to register an actor. When I write the code GlobalActorID.set("Name of Actor", _ActorAttribute); with my actor's name, I get the following error:

ChangeExpression: Unknown identifier : GlobalActorID
   from scripts.Design_14_14_ChangeExpression
   line: 100
   columns: 2-15


"ChangeExpression" is the actor behavior where I put the block containing the GlobalActorID.set code. The actor I'm trying to register is an actor type (the player) and I have no idea what to write in the "_ActorAttribute" part of the code.  :( :( What am I missing here?

rob1221

  • *
  • Posts: 9474
I can't tell what GlobalActorID refers to, but I guess it's something you created because I didn't find it in Stencyl's engine files.  That's the cause of the error you posted.

"_ActorAttribute" would refer to an attribute of type actor and named "Actor Attribute" or "ActorAttribute".  If you had an actor attribute called "Player" you would use "_Player" instead.  Note that an actor attribute is different from an actor type attribute.

I don't know what programming experience you have, but unless you're very comfortable with code in general I would recommend using design mode behaviors and use code blocks or extensions to insert any code needed.

DinaCardillo

  • Posts: 3
Hi! Thanks for your reply. I am trying to register an actor within Dialog Extension, and the "getting started" page says I need to do the following (direct quote):

To refer to an actor from within dialog, the actor must first be registered with the Dialog Extension by executing the following code: GlobalActorID.set("Name of Actor", _ActorAttribute);. Then, that actor can be accessed from dialog tags by "Name of Actor".

I read another thread in this forum where it was explained that you have to put that code inside a code block in a behavior, so that is what I did. I haven't tried to write any code myself or mess with anything beyond blocks and extensions, I'm only using what is provided in the Dialog Extension 'Getting Started' guide.

The actor I am trying to register is an Actor Type, and I am using its actor type attribute for the "_ActorAttribute" field. Still getting the error.

rob1221

  • *
  • Posts: 9474
Ah right, I overlooked what part of the forum this was posted in.
Quote
The actor I am trying to register is an Actor Type, and I am using its actor type attribute for the "_ActorAttribute" field. Still getting the error.
Your error is with GlobalActorID though, not the attribute, although if you're using "actor type" and not "actor" you'll probably get an error there as well.

DinaCardillo

  • Posts: 3
I understand. I get the same error with actor as I do with actor type. If my issue is with GlobalActorID, how can I solve it? Am I supposed to write something else there, the ID of the actor I want to register, perhaps? How do I get that? If anyone could show me with screenshots how to register an actor within Dialog Extension I would really appreciate it.