Get object name

This forum is currently in read-only mode.
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Is there not a way to get an object's name? If there is I'm having a hell of a time finding it

  • There's the id and uid, but that wont really help with picking.

    What you can do is compare it to something you already know, size, private variable, position, etc.

  • I need to store object names for later use in my level editor, then use 'create by object name' - a feature that seems pretty useless unless you can retrieve an object's name :T

    I guess I can store object names in private variables, but I mean..really?

    ASHLEY!!! Please consider adding 'get object name'

  • you should be able to create an object based on its ID if I recall correctly. Save that out with your level editor and then use that ID to create the objects you need. If your Level editor is integrated in with the same cap file that will be fine but if not then what you could do is have the name stored in a pv and then save that out and use that to create the object. Ive actually had this problem many times and I wrote a plugin for the purpose of easily creating objects i dont remember what happened to it though, and it may not work anymore with newer versions of construct.

  • ASHLEY!!! Please consider adding 'get object name'

    Not exactly a new request. And seeing that it hasn't been added yet, I wouldn't hold my breath.

    I need to store object names for later use in my level editor, then use 'create by object name' - a feature that seems pretty useless unless you can retrieve an object's name :T

    It's still very useful. Think about naming conventions and things alike.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Not exactly a new request. And seeing that it hasn't been added yet, I wouldn't hold my breath.

    I'm baffled. 'Get object name' should have been one of the first actions ever added to Construct, don't you think?

    Sigh. I'll stick with values then.

  • Its a long shot, but you could try a family, and a private variable.

    Both are presumably broken for this kind of thing, but who knows maybe 2 wrongs can make a right.

  • In this case, 2 wrongs make a disaster. You have been warned!

    Why not use a private variable to contain the name and a hashtable to track them?

  • In this case, 2 wrongs make a disaster. You have been warned!

    Why not use a private variable to contain the name and a hashtable to track them?

    This is pretty much what I'll be doing. I was just hoping there was a 'get object name' so I didn't have to spend so much time making new PVs for each one. Oh well, it won't take too long

  • Object name... Well, you can get OID and just use a string name as an alias for your convenience?

    As for instance names, same thing with UID.

  • The simplest way that I can think of would be to just use a hashtable, with no private variables.

    Just setup the table like this for each object you want to get the name of:

    + System: Start of layout
    -> HashTable: Insert key str(Sprite.OID) with value "Sprite"
    -> HashTable: Insert key str(Sprite2.OID) with value "Sprite2"[/code:2ad5ng9p]
    
    Then you can retrieve the name later with the OID of the object:
    [code:2ad5ng9p]-> Text: Set text to HashTable (str(Sprite.OID))[/code:2ad5ng9p]
  • ^ that is much better, yes. Basically you're using aliases for OID.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)