Picking a lock

In my game there is a locked toolbox. There is no key. You have to pick to lock on it with a nail.

How can I attach the action/verb ‘pick’ to the toolbox?

Thanks.

You can make a “picking it with” action:

picking it with is an action applying to two things. understand "pick [something] with [something]" as picking it with.

The basement is a room. The description is "A basement with a dirt floor and a low ceiling."

The toolbox is an openable locked container in the basement.

The nail is in the basement.

Instead of picking the toolbox with the nail:
	say "After a bit of struggle the lock pops.";
	now the toolbox is unlocked.

Sample output:

basement
A basement with a dirt floor and a low ceiling.

You can see a toolbox (closed) and a nail here.

>pick toolbox
What do you want to pick the toolbox with?

>pick toolbox with nail
After a bit of struggle the lock pops.

>open toolbox
You open the toolbox.

Perfect, thank you!

Alternatively you could fake it:

The Basement is a room.
The toolbox is a container in the Basement. It is closed, lockable and locked.

The player carries a hammer. The player carries a rusty nail. 
The matching key of the toolbox is the rusty nail. 

Understand "pick [something] with [something]" as unlocking it with.
Understand "lock" as the toolbox.

Report unlocking the toolbox with the rusty nail:
	say "After a bit of struggle the lock pops.";
	rule succeeds.

Check locking the toolbox with something:
	say "You fail to lock it." instead.

(It saves having to write generic rules for a new picking action—not that this would take much effort.)

When defining a new verb to use on [someting] be aware that it would be nice to define a negative response for the player attempting to use the command on other things (oh, they will). So I usually do a before check (when using instead) and specify the concrete, “meant to be” actions as instead of - this will produce meaningful errors instead of a blank line:

"Lockpicking" by HtF

picking it with is an action applying to two things. understand "pick [something] with [something]" as picking it with.

The basement is a room. The description is "A basement with a dirt floor and a low ceiling."

The toolbox is an openable locked container in the basement.
The bucket is a thing in the basement.

The nail is in the basement.

Before picking something (called TheTarget) with something (called TheObject):
	if TheObject is not the nail:
		Say "Hm, we need something else to try lockpicking with."  instead;
	if TheTarget is not the toolbox:
		Say "There's no need to try to lockpick that." instead;
		
instead of picking the toolbox with the nail:
   say "After a bit of struggle the lock pops.";
   now the toolbox is unlocked.

test me with "get nail / pick bucket with nail / get bucket / pick toolbox with bucket / pick toolbox with nail"

My only comment is to be aware of a subtle difference between BEFORE and CHECK:

The easiest explanation is you’d use “Before picking the lock…instead” for a message like “You know you don’t have the tools to pick the lock.” and “Check picking the lock…instead” for “As much as you work the icepick in the lock, it won’t open.”

You may not want

Before picking something (called TheTarget) with something (called TheObject): if TheObject is not the nail: Say "Hm, we need something else to try lockpicking with." instead;
to fire in a dark room.

Check picking something... ...instead

Will allow darkness and scope parsing first. This of course won’t apply if you’re not using darkness in the game, but it’s good to be aware of when your refusal messages are specifically based on sight or touchability.

Before rules are mostly intended for messages like

because Before rules continue by default. Of course, they will work to block action, but it’s a matter of preference.