Calling an attribute no matter where object or player is?

Hey, I'm trying to create a command that let's the player "think" about objects. This would basically give a secondary description for an object that includes more tasty LORE! and the main character's opinions. Currently this command prints out a string attribute of an object, which it does do brilliantly! In the room you're in.

This makes it a glorified "look" but I want you to be able to "think" about objects that are not present currently or aren't physically present in the actual story at all (but of course as objects in the game code). For example, you can think of a character that's three rooms over and you can also think about a planet that's colony is advertised on a poster, but you can't actually ever go there. Or maybe think about something obvious like Earth that is mentioned in descriptions but has no physical representation in the game.

Currently thinking of an inaccessible room where all these objects that aren't present could be and you could get the string attribute from there when needed. If one can get this to work, you can of course do it with other rooms and their objects. Another option I thought was an container on the player that would have objects that have been mentioned to you in story and you can think about them through there. Still, I would kinda prefer if these objects wouldn't have to be visible to you for this to work, but for example putting scenery items in your inventory doesn't work.

Aaanyhow, that's the idea. Help much need.


Look at the alternative scope section on this page:
http://docs.textadventures.co.uk/quest/advanced_scope.html

The way I would do it is give the THINK command a scope of "world" and then have it check ifthe memory attribute of the item exists. If it does, print, otherwise say you do not remember it.

Putting the objects in a certain location will get messy if the player can also find them in the game world.


Oh thanks! I did think about setting the scope but then thought it would just limit the scope.

Yeah, the idea of doing a clone to THINK about for each character, for example, sounded rather messy and a lot of work that I'd prefer to avoid.


If you set the command's scope to "world", it will work with any object or room in the game, whether the player can see it or not. So you can have objects that are mentioned but never seen in an inaccessible room somewhere, and then the player can think about both visible and abstract objects.

The downside of using 'world' is that the player could think about actual objects that they haven't found yet, which you might not want. So you could also take a slightly more complex solution, of making an object list of thinkable items. You could put objects into this list in the backdrop scope script (on the game's "advanced scripts" tab), using something like:

if (not HasAttribute (game.pov, "items_seen")) {
  game.pov.items_seen = ScopeInventory()
}
if (not ListContains (game.pov.items_seen, game.pov.parent)) {
  list add (game.pov.items_seen, game.pov.parent)
}
foreach (item, items) {
  if (not ListContains (game.pov.items_seen, item)) {
    list add (game.pov.items_seen, item)
  }
}

That basically means that whenever the player uses a command, the objects that are valid for that command get added to the items_seen list.
You could then give your "think" command the scope: Some inaccessible room;'items_seen to include both objects in the inaccessible room, and every object they've seen.
The disadvantage in this case is that some objects might be duplicates. For example, "think about door" shouldn't ask the player to choose between all the doors they've seen if there's one in the current room, because it's kind of obvious which one is meant. There are a few ways this could be dealt with, none of them particularly complicated.

I'd probably modify that by giving the "think" command a script attribute, changecommandscope, looking something like this:

visible = ScopeVisible()
nothere = ListExclude (items, visible)
foreach (item, visible) {
  foreach (duplicate, FilterByAttribute (nothere, "alias", GetDisplayAlias(item))) {
    if (ListContains (items, duplicate)) {
      list remove (items, duplicate)
    }
  }
}

That would mean that the command works on all items that have been seen by the player, but not items which have the same alias as something they can currently see. I think that if I was playing such a game, in most cases that would cause it to behave the way I expected.

Hope one of thoise suggestions proves useful to you.


Ah, Pixie beat me to it :)


Yay! Thanks to you both :> I'll start testing the more complex version soon.


Log in to post a reply.

Support

Forums