How can I make a command like "push ball east"?

What is the command pattern for direction? Is it
push #object# #direction#


I tried that, but it doesn't work.


I think you want push #object# #exit# - but the problem with that is that it decides which parts of the player's input belong to each variable before checking what objects exist.
So if the player types "push ball north east", Quest will look for an object called "ball north" and an exit called "east". But as long as all your exits have one-word names, I don't think it should be a problem.


You might also want to use text processor directives in the command's unresolved text, making it something like: You can't {either DictionaryContains(game.pov.currentcommandresolvedelements, "object"):go that way:see that} - so that if the player types an object that doesn't exist it says "You cant see that", and if the player types a direction that doesn't exist, it says "You can't go that way". (Without messing with the text processor, you'd have error messages like "You can't see that (north)" which doesn't sound right


I was also wondering how to make a custom response for trying to go somewhere, for example, when the player is falling and trying to go somewhere, print "You can't move while falling" instead of "You can't go there". (Sorry if that's a bit unclear)


If you just want to change the message, you could change the command's unresolved attribute.

But if you want to disable go in a specific room, you could create a new command with the same pattern as it, and put it in that room.


Before creating a new command you should delete the go command. Deleting the go command in the desktop version is easy enough. But you cannot access commands in the online version, so you'll need to change the pattern of go to something else.


Before creating a new command you should delete the go command. Deleting the go command in the desktop version is easy enough. But you cannot access commands in the online version, so you'll need to change the pattern of go to something else.

?

No. If you want to disable the go command in a certain room, you can create a new command in that room with the same pattern as go, and your command will run instead.

So if you want the player to get a different message if they try to go somewhere when they're falling, you would create a command called falling_go or something, and put the command in that room, with a script that just says:

msg ("You'll have to wait until you land before trying that.")

and give it the same pattern as the original go command.

If it's not a specific room where this happens, you could have a script run when the player starts falling:

MoveObject (falling_go, game.pov.parent)

and when they land:

AddToInventory (falling_go)

(adding a command to the inventory is a simple way to make it 'disappear' temporarily)

You could give this command a pattern something like:

^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$

which is the pattern of the built-in go command, to make sure that it works for all the different ways that the player can type the command.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums