Load packages the script depends on:

- <ref>actions</ref> for registering the new action;
- <ref>layout</ref> for searching selected objects and moving objects.

Create a function ev_action that will be called when any of the actions registered by the script is executed. The script registers only one action, so it does not need to check which action caused the function to be called.

When the action event is called, first set up:

- fetch event argument 0 and 1 using <ref>action_arg</ref>;
- resolve the conversion rate from mm to PCB's units using <ref>mm2pcb_multiplier</ref>;
- perform a search for all selected object using <ref>layout_search_selected</ref> (return value is the number of objects found), name the resulting list "mv_search"

A loop then iterates over the objects on the list:

- resolve the Nth element of the list using <ref>layout_search_get</ref>, referencing the list by name ("mv_search") and specifying which element to get (the Nth); the result is an object pointer;
- move the object using <ref>layout_obj_move</ref>; specify the object pointer, then which part of the object should be moved ("OC_OBJ" means the whole object) and relative offsets (dx and dy calculated earlier)

Finally the search list shall be destroyed to reclaim memory, using <ref>layout_search_free</ref>.

In the "main" section of the script, bind event <ref>ACTE_action</ref> to our local function ev_action - this gets ev_action to be called when any of the actions registered by this script is executed.

Finally use <ref>action_register</ref> to register the action:

- first argument is the name of the action
- second is the xy query string; it is empty since this action won't need coordinates to operate on
- third is the description that shows up in dumps and helps
- fourth is the syntax description (also for helps)