Pertex wrote:I do not understand that. If you have to use an object from which you can not find a hint in the game, then it's bad game design. And when the player takes the trouble to try all combinations of examine, it's admirable that he struggles with such a bad game. I would stop playing such a game immediately.
But if you really want to do something like that you could create an object with lots of aliases like a,b,c,d,e... and move it to the room the player is in.
Pertex wrote:I do not understand that. If you have to use an object from which you can not find a hint in the game...
if (StartsWith(name, value)) {
if (LengthOf(value) / LengthOf(name) >= 0.34) {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
Liam315 wrote:"Pertex"
I do not understand that. If you have to use an object from which you can not find a hint in the game...
I think it's more for if you examine one object more closely, it brings to the player's attention a second object etc. The room description mentions a painting, the painting description describes the hook it is hanging on, and the description of the hook contains some indication of what you can/need to do to solve the puzzle.
Having said that, I can't see players just walking into a room and trying to examine random letters on the off chance that they'll come across a "secret" item. You'd be better off making the object invisible to start with, and then triggering it to become visible when the player has done something correctly, e.g. look at a certain object.
There is a built in function within Quest called Compare names which you could also modify if you want to change the way object names are matched. You could do something where if the input is not of a certain length, it won't match it to an object. Something like:if (StartsWith(name, value)) {
if (LengthOf(value) / LengthOf(name) >= 0.34) {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
(The second "if" statement is the addition to the default code)
In this case, the length of any input has to be greater than just over a third of the number of characters in the full name. So if the object was "mirror" it would match "mirro", "mirr", and "mir", but not "mi" or "m".
Liam315 wrote:"Pertex"
I do not understand that. If you have to use an object from which you can not find a hint in the game...
I think it's more for if you examine one object more closely, it brings to the player's attention a second object etc. The room description mentions a painting, the painting description describes the hook it is hanging on, and the description of the hook contains some indication of what you can/need to do to solve the puzzle.
Having said that, I can't see players just walking into a room and trying to examine random letters on the off chance that they'll come across a "secret" item. You'd be better off making the object invisible to start with, and then triggering it to become visible when the player has done something correctly, e.g. look at a certain object.
There is a built in function within Quest called Compare names which you could also modify if you want to change the way object names are matched. You could do something where if the input is not of a certain length, it won't match it to an object. Something like:if (StartsWith(name, value)) {
if (LengthOf(value) / LengthOf(name) >= 0.34) {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
(The second "if" statement is the addition to the default code)
In this case, the length of any input has to be greater than just over a third of the number of characters in the full name. So if the object was "mirror" it would match "mirro", "mirr", and "mir", but not "mi" or "m".
privateer wrote:Your solution using the Compare names function looks interesting. That you very much for that.
Liam315 wrote:"privateer"
Your solution using the Compare names function looks interesting. That you very much for that.
The code I wrote is just one of many possibilities utilizing that function. Above obviously affects all objects in the game, but you could create conditions for specific objects as well. For instance, putting the relevant "secret" objects into an object list and having two sets of matching criteria - The default settings for most objects, and a more specialized set of criteria for the objects on the list, or if there aren't that many, a set of criteria for each individual "secret" object.
I posted something a while ago in the code samples section of the forum that's a modification of this function, whereby whole word matches are given preference over matches that contain that word as part of a longer word (e.g. if the input is "farm" and there are two objects "farm" and "farmer", it will return the farm object because the whole word is matched). You could modify those criteria for the "secret" object list so that those never accept partial matches but only matches for a whole word within the name/alias or alt names.
I don't know what level your understanding of the finer points of Quest coding is, but if you need a hand I'd be happy to help you out with crafting specifics to achieve what you need.
if (name = value) {
if (not ListContains(fullmatches, obj)) {
list add (fullmatches, obj)
}
}
else {
if (StartsWith(name, value)) {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
else {
// check if input matches the start of any word in the name
if (Instr(name, " " + value) > 0) {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
}
if (name = value) {
if (not ListContains(fullmatches, obj)) {
list add (fullmatches, obj)
}
}
else {
if (StartsWith(name, value)) {
if (LengthOf(name) >= 4) {
if ((LengthOf(value) >= 4) and (not ListContains(partialmatches, obj))) {
list add (partialmatches, obj)
}
}
else {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
else {
// check if input matches the start of any word in the name
if (Instr(name, " " + value) > 0) {
if (LengthOf(name) >= 4) {
if ((LengthOf(value) >= 4) and (not ListContains(partialmatches, obj))) {
list add (partialmatches, obj)
}
}
else {
if (not ListContains(partialmatches, obj)) {
list add (partialmatches, obj)
}
}
}
}
}
privateer wrote:
I think something like that is the way forward for me. I tried Pertex's nice idea, but was surprised to find that it just adds the single-letter object to the list of objects in the disambiguation menu! The idea was good in theory in that Quest ought to recognise the letter as a complete object name and therefore not ask for disambiguation, but it seems Quest makes an exception for objects with single letter names.