|
Axe Software Forums
Quest Developer Forum custom commands
|
Author | Topic: custom commands |
Russell |
posted 16-07-2001 19:08 GMT
Hi Folks, When I create a custom commmand in QDK/Quest such as marry#zelda##esmarelda#, and then open Quest Pro., and execute that command by only typing in, marry (without reference to an object), the command executes as if I had typed in marry zelda. This does not happen when I type in a regular Quest command such as take (without an object.) Quest Pro returns a query such as "I don't understand your command. Type HELP for a list of valid commands." Why doesn't Quest Pro do this for custom commands? This happens in all versions of Quest I believe. Is this a bug? If not, what am I doing wrong? |
Wizard |
posted 16-07-2001 19:52 GMT
Russell, Beta 3.0 has a feature that might help. You can check to see the number of parameters that were entered using the following system variable: #quest.function.numparameters# This will allow you to check for a complete entry yourself and take whatever action you see fit. Hope this helps, Wizard |
MaDbRiT |
posted 16-07-2001 21:21 GMT
Russell observed;
quote: Not a bug - just a misunderstanding of how to code custom commands. When you code command <marry #esmerelda#> do <marryprocedure> What you are actually doing is telling Quest to put whatever the player types after the word 'marry' into a string variable called 'esmerelda'. Unless your code makes some attempt to check the content of that string variable and process it accordingly, then typing marry (anything at all) will always run the code you have set up! What you need to do is code it either like this... command <marry esmerelda> do <marryprocedure> That will ONLY respond to the exact phrase 'marry esmerelda' being typed... or command <marry #girl#> do <marryprocedure> then do the procedure like so:- define procedure <marryprocedure> What actually happens here is that whatever the player types after 'marry' is stored in a string variable called 'girl'.. the Procedure checks that string variable and if it contains 'esmerelda' gives the 'congratulations' message, anything else gets the 'you can only 'marry' Esmerelda.' message. The latter option will give a better result, because the negative response makes more sense than just a dumb 'command not understood' anyway. Al |
MaDbRiT |
posted 16-07-2001 21:35 GMT
Following on from my last posting... You would probably also want to check that the #girl# string variable used in my suggested preferred solution wasn't empty, to deal more elegantly with the player just typing the word 'marry' on its own. It's not essential... 'You can only marry Esmerelda' is an acceptable repsonse to a player typing 'marry', but I'd probably code it so that Quest replied with something like.. Who do you want to marry? It's all about how the thing presents to the player after all. Al |
Russell |
posted 16-07-2001 23:42 GMT
ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh! Thanks! |