tworld icon indicating copy to clipboard operation
tworld copied to clipboard

Player Objects / ObjectIds: One of these should be both storable and usable in functions

Open 3Phen opened this issue 11 years ago • 2 comments

Since you've said you probably won't set up player-objects be assigned to values, it'd be nice if the various functions that take a player as an input would accept an ObjectId, since that's what we're able to store. Most of the following functions accept the acting player or a 'given' player, but the 'given' player must usually first be converted from an ObjectId:

event(you, others, player) location(player) setfocus("prop", player) unfocus("prop", player) access.level(player, level) players.name(player) players.pronoun(player) players.ishere(player) players.focus(player) pronoun.resolve(pronoun, player)

While we're on the subject, it'd be nice if there was something like players.list(loc) that returned a list of ObjectIds – since in the process of separating individual players to act with, you'll almost always want to assign them to a value.

I might be misunderstanding something fundamental here, my experience with Python and with this sort of structure was nonexistent before Seltani. But it feels rather silly to be constantly swapping back and forth with ObjectId(foo) every time I make an assignment and players.player(bar) every time I use a function.

3Phen avatar Sep 08 '13 01:09 3Phen

The current system is more verbose but more consistent. An ObjectId cannot be treated like a player all the time (since some ObjectIds represent locations), so the simple rule is that you always convert it to a player manually.

erkyrath avatar Sep 08 '13 02:09 erkyrath

I don't understand the difficulty here -- the ObjectId refers to an object that knows it's a player, right? That is, if you try to convert an ObjectId to a player manually, but the ObjectId is that of a location, then an error will occur. So it's never ambiguous.

sophialuden avatar Sep 08 '13 18:09 sophialuden