GetInput to create & name a new object?

What string/expression do I use to manipulate the newly created and user-named object?


If you're using a user-supplied string as an object name, you'd probably want something like:

get input {
  if (GetObject(result) = null) {
    create (result)
    obj = GetObject (result)
    if (obj = null) {
      msg ("Not a valid object name")
    }
    else {
      // code here to do stuff with 'obj'
    }
  }
  else {
    msg ("There's already an object with that name.")
  }
}

However, I can't see any case in which letting the player name an object is a good idea. Normally you'd pick a name for an object that you can use in the code, and let the player pick an alias.


That's a really valid point, and I hadn't considered the ramifications of that. Thanks.

Very new and diving in over my head, but loving it so far. Thank you for the quick response.


like mrangel said:

use the built-in 'alias' String Attribute for the in-game name of an Object (that's what it's there for, has the coding system already built-in for it to work properly for you too), while you set/input the actual names of the Objects for your own/code use (you really should never let the user name their own Objects, for reducing error and exception handling, and also for security/corruption-of-code-prevention)

Possibly, one reason, is if you want a 'crafting' system, with the user being able to input/choose/select their own custom name (again,via the built-in 'alias' String Attribute) for the Object that they 'craft' (create)


Log in to post a reply.

Support

Forums