Taking a step back, there are three ways I can see to approach this, before getting to the command. You could implement each letter as an object (as scenery probably) present at the top of the tree. The command will match
object2 to the specific object, letter u or whatever.
The second approach is a cheat; you just implement two locations, the right one and one that stands for all the wrong one, with a long list of alternative names (see second tab). Again the command will match
object2 to either the right object or the wrong object. Either way, the above code should work, just drop it in the script box and modify as per your game.
A better way might be to check the text, and not implement letters at all. Change the pattern to this:
drop #object# on #text#
And the code:
// Start by processing the text; make it all lower case
// and remove "letter" at the start if present
text = LCase(text)
if (StartsWith(text, "letter ")) {
text = Replace(text, "letter ")
}
// If the text is not a single letter, reject the command as nonsense
if (not LengthOf(text = 1)) {
msg("You can't see anything like that to drop it on.")
}
// If its the right letter and object, do special stuff
else if (object = huge_nut and text = "u") {
object.parent = bottom_of_tree
msg("You drop the " + GetDisplayAlias(object) + " and it lands at the bottom of the tree in a significant place.")
DoSpecialStuff
}
// It is not right, so do the dault
else {
object.parent = bottom_of_tree
msg("You drop the " + GetDisplayAlias(object) + " and it lands at the bottom of the tree.")
}