Take Using Another Object

TheBamforth
New member here.

I'm creating a game using Quest via the User Interface rather than coding.

All simple enough so far, though I've hit a problem with taking an object (say, an ice cube), with another object (say, tongs). Seems easy enough requiring another object when using custom verbs, though Take doesn't give you that option, and to create a custom verb of Take clashes with the default Inventory command. It would need the user to type 'Take ice cube with tongs' rather that 'use tongs with ice cube'. I'm sure there must be a simple way I'm missing.

Thanks in advance!

Father thyme
You could put in a script in cube inventory section .if the player attempts to take cube. Something like " You need to use something with it to protect your hands it is very cold." Or whatever reason.
Go to tongs features and tick use
Go to use with another object
Enter cube
This will enable " use tongs with cube."

Father thyme
You then need to add cube to inventory

TM123
on the ice cube inventory tab, change the Take: "Default behaviour" to "Run script"
below that click "Add new script"
under "Scripts" click on "If..."
this gives you "If: expression" type in the box: "Got (tongs)" That has to be a capital "G"
below that it says "Then:" and "Add new script" - click "Add new script"
under "Objects" click on "Add to inventory"
that gives you "Add to inventory object" select ice cube from the list box.
click the "Add new script" below that.
under "Output" click "Print a message"
that gives you "Print message" type in the box: "You get the ice cube with the tongs."
Below that, click on "Add Else" Click on the "Add new script" that appears. Select "Print a message"
enter "You need tongs to get the ice cube."

The Pixie
TM123's way is the easy way, but only handles TAKE ICECUBE. If you want TAKE ICECUBE WITH TONGS, you will need to implement a new command. Set the pattern to be a regular expression, and then put in this:

^(get|take|pick up) (?<object1>.*) (using|with) (?<object2>.*)$

If the script part, you would need to check object1 is the icecube and object2 is the tongs.

TM123
You could add an integer attribute: player.numberdrinksconsumed and make it increasingly difficult to get the ice cube depending on the number of drinks, after 10 drinks, it would be impossible:

if (Got (tongs)) {
percentile = player.numberdrinksconsumed * 10
if (RandomChance (percentile)) {
msg ("Whoops! You missed the ice cube. Had a few too many, haven't we?")
}
else {
AddToInventory (ice cube)
msg ("You get the ice cube with the tongs.")
}
}
else {
msg ("You need tongs to get the ice cube.")
}

TheBamforth
Thanks for your suggestions... I'm not actually using ice cubes, it was just an example, but thanks for that suggestion.

Pixie: I'm new to Commands so I'm not sure where to put that new Command on the Interface (above Name or on the script?)

As it is, I've created a new Command: Take Battery With Tongs (object is battery), which seems to work for that specific expression. What would be handy would be if there was more flexibility so I could, say, list some variation on the expression which returned the same result without having to duplicate the code (say, get battery with tongs, reach battery using tongs etc), then it'll be far easier for the player.

I'm a 'jump right in' person, so yes, I would probably have the answers if I went through the whole tutorial.

XanMag
If I understand you correctly...

I think all you need to do is separate the commands you think the player may type in with a semi-colon.

So... in the box under pattern (under the command tab for the battery(I think)) just do this:

take battery with tongs; get battery with tongs; reach battery using tongs; etc

Let me know if this helps.

TheBamforth
That works a treat! Should save a lot of time for very specific actions.

While I'm here, my latest issue is dealing with an object which has been cloned from another.

It looks like, while both objects have the same attributes, the code I created for the first doesn't seem to apply to the second - presumably you have to account for each clone and its given the different names. Is there a way of making the code recognise them as if they were the same object? If not, I'll just have to create a limited number of clones as different objects with different names.

XanMag
I've never actually used the clone script in the GUI. Whenever I need multiple objects with the same characteristics, I simply copy-paste (click the 2-paper button at the top-click the clipboard button just next to it) them and move them as needed from room(s) to my item warehouse. My item warehouse is just a storage room for items that the game player cannot access (I currently have 70 items in my item warehouses =)

It can be a bit cluttered but works well for me.

You should be able to give them all aliases for the game to recognize them as the same. For example, I have about six chairs in my current game and their names are chair, chair1, chair2, etc... and in the alias box, I have named it just 'chair'. The game will recognize chair1, chair2, chair3, as chair. Now, if you have two identical objects in the same room/inventory, that might cause some problems, but I think for what you are doing, you plan on making all of the "same" objects inaccessible if the player is carrying one of them. Yes?

The Pixie
TheBamforth wrote:That works a treat! Should save a lot of time for very specific actions.

While I'm here, my latest issue is dealing with an object which has been cloned from another.

It looks like, while both objects have the same attributes, the code I created for the first doesn't seem to apply to the second - presumably you have to account for each clone and its given the different names. Is there a way of making the code recognise them as if they were the same object? If not, I'll just have to create a limited number of clones as different objects with different names.

If you are talking about script attributes, then the clonmes will have them, and it should work fine. I am guessing you do not mean that.

If you mean in a command or similar, it depends how you check for the item. Using XanMag's example, you could check that the item has the alias "chair", which will match the original and its clones

TheBamforth
I was trying to make it so a new ticket appeared from a machine when you take one, though it was getting messy (especially when tickets started to close just by picking a dropped ticket off the floor), so I've scrapped the idea and limited it to two tickets and made them separate objects.

When I first had a go with Quest it was an older version and I seem to recall it being quite easy to have quantities of the same object, and that number showing in the inventory list (grenades: 3), though I haven't see it in this version yet, so I've had to create an attribute.

Yet another question: Just to keep things tidy, is there a way in which you can cut down on the code by ordering whole phrases, say, "shoot guard with gun" to automatically convert to "use gun on guard", so that when you make a change to that code, you don't have to change it in more than one place... or must I copy and paste the code in both places?

As ever, thanks for your continued answers!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums