"lookdir" for Alternative Aliases
homeeman
11 Feb 2013, 07:03As a personal preference, I don't care for the traditional compass directions as a method of navigation. I ignore the all the compass hullabaloo on the "exits" tab and just add them at the bottom, without any directional association. This works fine, until we come to the situation of "look" text.
It doesn't work. A workaround would seem like a five-minute no-brainer, but I'm struggling here, guys.
There aren't any problems if you replace the current lookdir expression {^look (?<exit>all|the|directions|and|such)$} with its logical counterpart {^look (?<exit>.*)$}, but very few of my exits would work with this expression, as they're almost always the name of the room (your bedroom, the living room, the top of the volcano). Instead, I tried changing the expression to look at the stuff.
That didn't work, because then, depending on whichever expression came last, either objects or exits weren't look-at-able.
So, I tried changing the "unresolved" attribute for look at #object# to <unresolved type="script">lookexit()</unresolved> (where lookexit() was a function with the same script as lookdir).
Nope, it went straight to the unresolved object template. So I tried changing that in a similar manner. Nope.
So then I decide that shooting into the dark and trying to change text-only templates into full scripts isn't going to work, and that I need to dig around in the core files to see if I can find where it is that causes the lookat to go directly to the unresolved object template. After a lot of digging, I could only conclude that the script that handles the numerous commands that involve objects (and what to do if those objects are unresolved) was either somewhere just out of my reach, or somewhere in the pile of files that aren't in the Core or Languages folder, which has all sorts of messy stuff I might not feel comfortable messing with.
So if you aren't out of ideas at this point, I'd love to hear what you've got to see if you can help me out of this jam. Thanks for your time, guys.
*EDIT*: I don't seem to have been very clear in this post, since most people start their responses by telling me they weren't sure what I meant, so I'll try to be clear: When the player tries to look at my exits, it gives the response "You can't see that." This is because the command that handles looking at exits is built to only handle commands geared towards the compass directions. What I've detailed above is the measures I took to try to fix this (which didn't work). So hopefully, now that I've made myself coherent, you guys can help me out.
It doesn't work. A workaround would seem like a five-minute no-brainer, but I'm struggling here, guys.
There aren't any problems if you replace the current lookdir expression {^look (?<exit>all|the|directions|and|such)$} with its logical counterpart {^look (?<exit>.*)$}, but very few of my exits would work with this expression, as they're almost always the name of the room (your bedroom, the living room, the top of the volcano). Instead, I tried changing the expression to look at the stuff.
That didn't work, because then, depending on whichever expression came last, either objects or exits weren't look-at-able.
So, I tried changing the "unresolved" attribute for look at #object# to <unresolved type="script">lookexit()</unresolved> (where lookexit() was a function with the same script as lookdir).
Nope, it went straight to the unresolved object template. So I tried changing that in a similar manner. Nope.
So then I decide that shooting into the dark and trying to change text-only templates into full scripts isn't going to work, and that I need to dig around in the core files to see if I can find where it is that causes the lookat to go directly to the unresolved object template. After a lot of digging, I could only conclude that the script that handles the numerous commands that involve objects (and what to do if those objects are unresolved) was either somewhere just out of my reach, or somewhere in the pile of files that aren't in the Core or Languages folder, which has all sorts of messy stuff I might not feel comfortable messing with.
So if you aren't out of ideas at this point, I'd love to hear what you've got to see if you can help me out of this jam. Thanks for your time, guys.
*EDIT*: I don't seem to have been very clear in this post, since most people start their responses by telling me they weren't sure what I meant, so I'll try to be clear: When the player tries to look at my exits, it gives the response "You can't see that." This is because the command that handles looking at exits is built to only handle commands geared towards the compass directions. What I've detailed above is the measures I took to try to fix this (which didn't work). So hopefully, now that I've made myself coherent, you guys can help me out.
TriangleGames
11 Feb 2013, 13:09I'm a little unclear exactly what you're trying to achieve, but you should be able to write in a custom alias for exits under the attributes tab of the GUI, and then if you need to do more with it you could see what that changes in the code.
homeeman
11 Feb 2013, 17:42Well that's exactly what I do. My problem is that when the player tries to "look at" the exit, it doesn't work correctly because the look command for exits assumes you're using a compass direction... but I don't like the compass either.
I'm all about keeping those fingers on the keyboard.
I'm all about keeping those fingers on the keyboard.
homeeman
15 Feb 2013, 16:13I also recently tried duplicating all the phrases (within the expression for the command) but replacing the ?<object>.* with ?<exit>.*, but that didn't really work either. Although, there really wasn't a good place to splice in the code for handling exits. Any ideas at all?
dellaqia
16 Feb 2013, 15:16I don't know if I understand very well what you've said but I became stuck in someting like that recently and maybe I can help a little bit. I also like to say "look at north" or some other direction hardly ever and prefer to say "look thru the window" ("olhar pela janela" in my language) or something like it. I thought I could just add new verbs to the command named "lookdir" [^olhar para (?<exit>.*)$|etc...], such as ^olhar pela and ^olhar pelo (since Portuguese distinguishes between masculine and feminine inanimate objects) but it didn't work. Although possible, ^olhar para (look at) only works for directions for when it is applied to objects it means the same of "examine", whilst the others terms just work for some objects. So, I added the term "olhar pela" (look thru) to the verb tab of the object "janela" (window) that happens to be at north wall of my room and I could use both directions and a direct reference to the object, since I attach a proper script to the verb, of course. I think you can do the same, at least when refering to rooms, like bedroom or whatever. In any case you look thru something, a door or a window, for example. Regarding to unresolved types there is a dynamic template in the English.aslx that handles it, the "YouLooking" one. Maybe you can do something with that.
homeeman
16 Feb 2013, 22:07Yeah, you've run into the same problem I have. But I'm just polishing a finished game. It's never necessary for the player to look at any of the exits, I just want them to have the option. I could put an object in every room with the same alias as the exit, and that could work, you're right, and it's not a bad idea...
But I'd rather just coax the "lookdir" command into working, since it's not a necessary component, and because there are a lot of rooms I'd have to add new objects to.
As far as the YouLooking template goes, that also only works for directional references, and not to alternative exit names. Thanks for the suggestion, though, I'll have to keep that in mind in case I ever decide to have the player look at any exits, because I just can't let myself use cardinal directions.
But I'd rather just coax the "lookdir" command into working, since it's not a necessary component, and because there are a lot of rooms I'd have to add new objects to.
As far as the YouLooking template goes, that also only works for directional references, and not to alternative exit names. Thanks for the suggestion, though, I'll have to keep that in mind in case I ever decide to have the player look at any exits, because I just can't let myself use cardinal directions.
HegemonKhan
16 Feb 2013, 23:33is it possible to do a "GetExit" function, and then check if it matches up with having the alias, which then would allow you to do what you want? As I think I had to do something similar to this for getting a command to work with recognize the object's alias, so that it could work when the game player typed in the object's alias for the command. As it normally checked for the the object's name when doing the command, and thus it couldn't find it, due to the object having the alias, without the extra "get and check~match up" scripting.
homeeman
17 Feb 2013, 07:12You know, as a student who is minoring in computer science I usually strive to let Quest do most of the heavy lifting, using the built-in features where I can to help me out since I get all the programming practice I can stand, but I think you're really on to something here.
Do you happen to know of a way I might go about allowing the player to use the phrase "look at" for looking at objects and exits alike?
Hmmm... actually, if I were to generalize the command to have it just read ?<text>.* and then use a GetObjectorExit script to direct it towards different functions I could make it work. It doesn't sound like much fun, but I'm sure I can do it. I'll be fine to get it done on my own (I don't always play well with others on this sort of thing) but I'd like to go ahead and encourage anyone who thinks they can think of an easier (or more efficient) way to go about something like this to speak up before I make some big ugly monster command and then find that there was an easier way to do it.
Do you happen to know of a way I might go about allowing the player to use the phrase "look at" for looking at objects and exits alike?
Hmmm... actually, if I were to generalize the command to have it just read ?<text>.* and then use a GetObjectorExit script to direct it towards different functions I could make it work. It doesn't sound like much fun, but I'm sure I can do it. I'll be fine to get it done on my own (I don't always play well with others on this sort of thing) but I'd like to go ahead and encourage anyone who thinks they can think of an easier (or more efficient) way to go about something like this to speak up before I make some big ugly monster command and then find that there was an easier way to do it.
HegemonKhan
17 Feb 2013, 09:10you could always edit (alex' core quest) or create your own core codings... as if there's no other better built in way, then there is not another way other than this. If you go the command+function route, then it's a matter of creating the best code method you can (simpliest most efficient code possible).
here's how my code looks:
(this is a part of my battle function, so you'll have to adjust it and figure out how to get it to work for exits and their aliases)
here's how my code looks:
(this is a part of my battle function, so you'll have to adjust it and figure out how to get it to work for exits and their aliases)
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<function name="battle_system" parameters="self,text" type="boolean">
first_value = false
enemy = GetObject (text)
// Credit goes to Pertex, as he~she provided this code below to me
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}