Moving dropped item to different room?

XanMag
29 May 2015, 02:53I'm trying to tidy up a situation in my first game. There is a point where a player must "drop [correct object] on [location]" from a high vantage point. The object must be a specific object. I can get that part correct. ALL OTHER objects I want to be able to "drop [incorrect object] on [location]". The single object is easy because I just used a command where I typed variations of "drop [correct object] on [location]". Then, in the script, I just moved [correct object] to [location].
I need a command where I can drop any OTHER object and move that specific object to the location far below. I've tried things like: drop #text# on #text#, but that overrides the correct object drop. This is definitely a coder question and I don't know how to resolve it. I could just add a command for EVERY object in the game but... not even I am that desperate!!
In short, I have: drop object A on location. Object A is moved to the location.
I need: drop object B (or object C,D,E,F,H, etc) on location and then moved to that location.
Make sense?
Thanks!
I need a command where I can drop any OTHER object and move that specific object to the location far below. I've tried things like: drop #text# on #text#, but that overrides the correct object drop. This is definitely a coder question and I don't know how to resolve it. I could just add a command for EVERY object in the game but... not even I am that desperate!!
In short, I have: drop object A on location. Object A is moved to the location.
I need: drop object B (or object C,D,E,F,H, etc) on location and then moved to that location.
Make sense?
Thanks!
HegemonKhan
29 May 2015, 03:47<command name="xxx">
<pattern>drop #object1# on #object2#</pattern>
<script>
if (object1 = null) {
foreach (object_variable, AllObjects () ) {
if (object_variable.alias = the_correct_object's_alias'_value) {
// or if you want to use that 'alt~alternative names list' of Objects: if (ListContains (object_variable.List_Attribute_name, alternative name 1) or ListContains (object_variable.List_Attribute_name, alternative name 2) or etc etc etc) { script }
object1 = object_variable
}
}
}
if (object1 = null) {
msg ("Wrong input, try again.")
} else {
if (object1 = name_of_the_correct_object) {
// whatever script for this 'correct action'
} else {
// whatever script for this 'INcorrect action'
}
}
</script>
</command>
I'm not sure if this is what you wanted... do you want correct and incorrect Objects to be moved~dropped to the same location ??? do you want to check if the inputted location is the correct vs incorrect location ??? etc etc etc
The Pixie
29 May 2015, 06:53What is "location"? Is it a thing in the current room? If it is not, then "drop #object1# on #object2#" will not work, because object2 will not be present (in the current room or inventory).
Assuming it is a thing in the current room, then Quest will put the stated objects in variables object1 and object2, so there is no need to check if they are null, HK. All the script needs to do is check if this is the right object and location:
Assuming it is a thing in the current room, then Quest will put the stated objects in variables object1 and object2, so there is no need to check if they are null, HK. All the script needs to do is check if this is the right object and location:
if (object1 = my_special_object and object2 = my_special_location) {
DoSpecialStuff
}
else {
// Normal drop
object1.parent = player.parent
msg("You drop the " + GetDisplayAlias(object1))
}

XanMag
29 May 2015, 10:24Clarification: "location" is simply a room. When the incorrect object is dropped, that object ends up in a different room. The setup is this... The player is at the top of a tree and they look down. From this high vantage point (4 layers up on the map), they can see a grid with spots on the ground. So, they need to drop an object on the correct spot to mark it. "Drop _____ on ____" (2nd blank is one of many visible targets that are only visible from treetop). Only one object works correctly. That part I figured out. The issue I have is if the player chooses to drop any other object to mark the ground below. So, the location is always the same for any incorrect object being dropped - it's just the ground level 4 layers down. The correct command triggers an event (that much I get).
Thanks.
Thanks.

The Pixie
29 May 2015, 20:43Not sure if I quite understand, but it sounds like "location" is an object in this room from "one of many visible targets that are only visible from treetop". So you jusat need to modify the above slightly:
if (object1 = my_special_object and object2 = my_special_target) {
object1.parent = special_room_at_bottom_of_tree
msg("You drop the " + GetDisplayAlias(object1) + " and it falls all the way to the base of the tree just where you want it!")
}
else {
object1.parent = ordinary_room_at_bottom_of_tree
msg("You drop the " + GetDisplayAlias(object1) + " and it falls all the way to the base of the tree.")
}

XanMag
31 May 2015, 17:02Can I put that code above in the command line under regular expression? Or do I need to put some lingo in as a command typed by the player and add the 'If' statement to the script?
*SPOILER* for 'Xanadu - the World's Greatest Hope'
There is a large expanse of ground at layer 0. There is a huge tree that you can climb up 4 times. Once at the top, you can look down and see a unique pattern on the ground. This pattern is 26 possible targets (letters of the alphabet). The player can only see this spot from the tree top (not the ground below), so the player needs to mark it from the tree top. If the player drops a specific item (a huge nut) from the top of the tree at the correct target below, it triggers an event to happen. So, the correct command is: 'drop nut on letter u'. This solves the riddle. I also have figured out how to respond if the player types 'drop nut on letter s', or 'b', or 'm', for example. The player climbs down the tree and finds the nut on the large expanse of ground, but no event has been triggered.
I need to know how to 'drop plank', or 'drop berry', or 'drop key', or 'drop bowl' on ANY letter, etc, etc, etc... will result in the dropped object being found at the expanse of ground below the tree (regardless of what spot they were aiming for). Drop plank on spot q, drop berry on spot h, drop key on spot a, drop bowl on spot u... should all simply move whatever object was dropped in an attempt to mark the ground below to the ground below (4 rooms down).
Thanks and I apologize if you've already answered this above, but I couldn't figure it out based on the solution you kindly offered.
*SPOILER* for 'Xanadu - the World's Greatest Hope'
There is a large expanse of ground at layer 0. There is a huge tree that you can climb up 4 times. Once at the top, you can look down and see a unique pattern on the ground. This pattern is 26 possible targets (letters of the alphabet). The player can only see this spot from the tree top (not the ground below), so the player needs to mark it from the tree top. If the player drops a specific item (a huge nut) from the top of the tree at the correct target below, it triggers an event to happen. So, the correct command is: 'drop nut on letter u'. This solves the riddle. I also have figured out how to respond if the player types 'drop nut on letter s', or 'b', or 'm', for example. The player climbs down the tree and finds the nut on the large expanse of ground, but no event has been triggered.
I need to know how to 'drop plank', or 'drop berry', or 'drop key', or 'drop bowl' on ANY letter, etc, etc, etc... will result in the dropped object being found at the expanse of ground below the tree (regardless of what spot they were aiming for). Drop plank on spot q, drop berry on spot h, drop key on spot a, drop bowl on spot u... should all simply move whatever object was dropped in an attempt to mark the ground below to the ground below (4 rooms down).
Thanks and I apologize if you've already answered this above, but I couldn't figure it out based on the solution you kindly offered.
HegemonKhan
31 May 2015, 17:53I'll let Pixie finish helping you, as he~she is much better at it, more clear and concise help, than mine, hehe.
The Pixie
31 May 2015, 20:59Taking 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:
And the code:
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.")
}