How do I make a command like Examine or any number of other things?

Jerrid
25 Nov 2020, 22:01I apologize for this. I am sure it is somewhere in the tutorial or a search will do it, but I am very pressed for time at the moment and at the library and internet at home is not allowing me to respond with the CAPTCHA for what ever reason and it may be days before it is resolved and just incase the info is not here some where... I would like to know how to make an "Examine" command and how to short hand to "EX" or what ever for ease of use to the player.
I want it to be so there is still of course the Look command on it's own. Even Look at an object for more detail, but Examine for instance would take it one step further and go into even greater detail. And I may even want another command to go into even greater detail for what ever reason later on.
Again I apologize for this odd request. I know answering questions that could be easily answered is tiresome, but in case it can not be found, I may not have a chance to ask this question for days. Hopefully I will even be able to see the responses later at the rate my internet/laptop is acting. ^^! Thank you for your time and patience.
mrangel
25 Nov 2020, 23:24I would like to know how to make an "Examine" command and how to short hand to "EX" or what ever for ease of use to the player.
Quest already has an examine command. It's one of the aliases for "look at".
In theory, there's nothing to stop you creating a new one, but the editor might tell you that your new command clashes with a built in one.
You can create a command by clicking on 'Commands' in the sidebar, and then clicking "add" to create a new one.
You'd want to give it the name examine
and the pattern examine #object#;ex #object#
.
Then when the command is used, the variable object
can be used to refer to the object being examined.
I'd suspect that to examine an object you'd need to be close enough to touch it, and that if an object doesn't have a more detailed description, it should just show the standard "look at" description.
So the script for your command (iin code view) would look something like:
if (not ListContains (ScopeReachable(), object)) {
do (lookat, "script", QuickParams ("object", object))
msg ("You can't get close enough to examine it more closely.")
}
else if (HasString (object, "examine")) {
msg (object.examine)
}
else if (HasScript (object, "examine")) {
do (object, "examine")
}
else {
do (lookat, "script", QuickParams ("object", object))
}
Then, for each object you can go to the Attributes tab and make an attribute named examine
. It can either be a string, which will be displayed when the object is examined, or a script that will be run when it is examined.
Curt A. P.
26 Nov 2020, 00:27You can paste the script of mrangle on the command with the web editor but there is no Attributes Tab in the web editor.
However, you can go to the object's Features Tab and activate "Run an initialisation script for this object".
The "Intialisation script" Tab will appear on the object. There you can set the examine attribute for all objects which should respond to the command.

Jerrid
26 Nov 2020, 07:09I used Commands in the left side bar where "skeleton" of the game is at and created Examine. Then used Examine as the name and I left the pattern as Command pattern and the box directly underneath that I pasted the code- examine #object#;ex #object#
I then went to an object in the room and in the attributes tab I typed something trying first the script with print a message and when tested it did not work, so I tried it with string, but it still did not work either. Does the code have to be in there?
I am also using the desktop version if that means anything.
mrangel
26 Nov 2020, 08:57"doesn't work" is not helpful.
What happens when the player types "examine bucket" or whatever? Does it give an error?

Jerrid
26 Nov 2020, 16:37It only says what you type, so typing "Examine table" gives you-
Examine table
instead of the description I had given it.
mrangel
26 Nov 2020, 17:57That's really strange. Could you add some breadcrumbs?
Like, add an extra line at the beginning of the command's script, like:
msg ("Trying to examine " + object.name)
msg ("Examine is: " + object.examine)
That should test that the command is actually running.
Curt A. P.
26 Nov 2020, 20:38the box directly underneath that I pasted the code- examine #object#;ex #object#
The box for the pattern is above the name.

Jerrid
27 Nov 2020, 01:34Mrangle is there a way you could post the rest of the screenshots for the scripting please? Also I do not think I am too concerned with needing to be close to an object, as the rooms are actual rooms of a building currently and if you are in a room almost everything in that room should be in reach, if that makes any sense. So if I was in the bedroom, I could not get fruit from the kitchen. If I was in the kitchen however, I could grab the fruit. So if you could explain or just leave that part out of the coding if it is not needed that would be appreciated.
There is no "You are standing next to the counter of the kitchen, you can not reach the fruit on the kitchen table" sort of thing. Basically you are everywhere in the kitchen at the same time. Also I think the game automatically determines if you are not in the same room as an item is in, than the item (to the player) does not exist or at least can not be interacted with.
mrangel
27 Nov 2020, 13:30Mrangle is there a way you could post the rest of the screenshots for the scripting please?
I've updated the screenshot above, as the previous version cut a couple of pixels off the bottom of the last line.
Also I do not think I am too concerned with needing to be close to an object
It's not really close. Quest has separate concepts of 'visible' and 'reachable' object; most of the core commands check if an object is reachable before doing anything with it.
If you haven't done anything with reachability, then it won't make any difference; just ignore the first 'if' block.
In the default behaviour, the only items that are visible but not reachable are objects inside a transparent box (you need to open the box first), or objects explicitly placed in scope (for example using the "look at objects through a window" script I've seen a few times).