Look Non-Directional Exit

Sorry for the probably easy question, but I feel like I'm taking crazy pills. I'm in the process of making some escape room games, and already published two. A comment yesterday suggested that I allow looking at the directions in the room (one room, multiple parts, made for an easier scenario). Fair enough. Only I can't seem to figure out how to "look" at non-directional exits, and my searching the forums and code has proved fruitless so far, because I'm not sure what I'm missing.

First, I don't know the easy way to do this in the program. I saw a forum post ( http://textadventures.co.uk/forum/quest/topic/5979/look-in-this-direction ) from 2016 about a similar question, and then someone offered this advice:

Click the exit you want in the pane on the left. At the very bottom of this screen there is an option to 'Look (in this direction)'. Run your script in there. If you are in a car, for example, and typed 'look out' (if out is your exit direction), the print message script will give the player a description of outside the car.

I've looked everywhere (heh) that I thought appropriate, like the tabs for the individual exit objects, or the room object Exit tab, but I cannot find any sort of selection for a "Look in this direction" option.

That said, I know that the code is generally just adding a "look" attribute with a text string of what you want printed when the player types "look direction" That works all well and fine when the exits are general directions, like east, west, etc. I've made some dummy exits, added the look attribute with the text I wanted, and everything worked fine.

But when I did the same thing for a non-directional exit, the program always returns that the object cannot be seen. Same settings (Scenery not checked, Visible, etc - I've both copied a current exit and created new ones with the same outcome) as the directional exit and everything, so the only thing that I can perceive is different is the alias and setting that it is a non-directional exit, which means it does not have any inherited attributes.

For example, if I am at the "entrance" of my speakeasy, there is a visible exit with an alias "bar", and you can go to it by either clicking on the hyperlink in the side panel or main screen, or typing "go bar". So I KNOW that there is an object with that alias there. But when I add the "look" attribute, and type "look bar", I simply get the return "I can't see that".

Sorry for the wall of text, I'm just frustrated and tired and really want to not feel dumb about this.


If it’s typed commands then simply create a scenery object called bar or whatever and put the description in there.
Hmm this might cause problems. I never implement the interface as you inevitably come up against stuff like this.


OK ... there are two commands. "lookat" looks at an object, and "lookdir" deals with the special strings "look north", "look east" and so on.

lookdir's pattern matches the specific names of the directions, so can't be used for non-directional exits, and lookat only handles objects.

However, under Quest 5.8 I think you could make this work properly by giving the lookat command a script attribute.
Something like:

lookat.changecommandscope => {
  foreach (exit, ScopeExits()) {
    list add (items, exit)
  }
}

This should then force the exits (including non-directional exits) to be in scope for the lookat command, which would treat them as objects.


Silver, I was attempting to do that at first as well, but it was becoming quite cumbersome, and I had to be careful with how I named certain objects. It WAS working to an extent, though.

mrangel, the script you provided one hundred percent worked! And it makes so much sense, too. I'm just afraid that I'm such a novice at scripting that such a thing didn't occur to me. I placed the script into my custom lookat command and it worked perfectly! Thank you so much!


That's pretty dang cool.


(It's worth noting that you can use changecommandscope to put anything you want into scope. So you could theoretically have a command where #object# can match objects, exits, turnscripts, or commands. I can't think of many uses for the latter; except maybe some kind of magic system that uses commands for its spells, and gives the player commands to rename/upgrade/forget them)


Log in to post a reply.

Support

Forums