non-directional exit issue
crystalwizard
24 Jan 2017, 03:36I'm using the desktop editor.
I can create a non-directional exit, and the hyper link moves the players between rooms just fine. But trying to use the aliases just returns the error "I don't understand your command."
Any suggestions as to how to fix this so players can type in the alias instead of having to click on the hyperlink would be appreciated.
The Pixie
24 Jan 2017, 08:26Try doing it as a command like this:
You can go to the {command:go kitchen:kitchen}.
The "go kitchen" bit is the command that Quest will use, whilst "kitchen" after that is what is displayed.
Pertex
24 Jan 2017, 13:00If you have a non-directional exit with the alias "house" you can type "go house". Just typing "house" is not possible.
But you could do something like this. Import the core function HandleSingleCommand and add this code at the beginning:
foreach (exit, ScopeExits()) {
if (GetAttribute(exit, "alt") = null){
if (exit.alias = command){
HandleSingleCommand ("go " + command)
return (null)
}
}
}
The method should look like this then:
<function name="HandleSingleCommand" parameters="command">
<![CDATA[
foreach (exit, ScopeExits()) {
if (GetAttribute(exit, "alt") = null){
if (exit.alias = command){
HandleSingleCommand ("go " + command)
return (null)
}
}
}
candidates = NewObjectList()
foreach (cmd, ScopeCommands()) {
if (IsRegexMatch(cmd.pattern, command, cmd.name)) {
list add (candidates, cmd)
}
}
maxstrength = -1
thiscommand = null
...
A question to the Quest chiefs:
Should something like this added to the Quest core?
crystalwizard
24 Jan 2017, 15:58Okay, next question. For certain types of aliases i'd like to have a speciall command, but not in the entire game.
So, for example, i have a room with a stream and a path. I'd like the player to be able to type
follow stream
or
follow path
and have them each both move the player to the correct room. I can't just put a follow command into the game, because in most cases I don't want it to work. And I can't even put it in the room because I don't want the player to be able to type
Follow north
and have that work (that's silly).
Is there a way to do this in the exit itself?
hegemonkhan
24 Jan 2017, 21:11I don't think this is what you're asking for, but it's a way of doing what you want, I think...
Object parent-child heirarchy / containment (and thus in-game location), is actually controlled by the built-in 'parent' Object Attribute, so you can use this instead of Exits and/or along with Exits (editing the Exit scripting and putting in the desired 'parent' code line, or however else related to Exits' usage) too.
player.parent = room // the 'player' Player Object is now in the 'room' Room Object
// which is the same as:
MoveObject (player, room)
// which is the same as using Exits to do the same thing
// which is the same as doing it in the GUI/Editor (though GUI/Editor is for/at compile-time only):
<object name="room">
<object name="player">
</object>
</object>
Pertex
25 Jan 2017, 06:53You can create a local command that only works in one room. Right click on a room and choose "Add Command"