One of the strengths of a contraption is that code running outside the contraption doesn’t know about what’s happening inside it. That means when you’re creating a contraption prototype you don’t have to keep in mind all the other thing going on in a deck, and when you’re working on the deck you don’t have to keep in mind the contents of every contraption. However, that does mean you need to take care when getting data into or out of a contraption.
In short, a script outside the contraption can’t refer to widgets inside it… at least, without permission.
Code outside the contraption can poke at all the attributes listed in the Contraption interface in the Decker documentation, but the contraption can add extra attributes of its own. If your prototype’s script has a handler like this:
on get_gimmefive do
5
end
…then code outside the contraption can do somecontraption.gimmefive and get 5 as the result. In the same way, if your prototype script has a handler like:
on set_taketen val do
if val = 10
alert["Thanks!"]
else
alert["Not what I asked for."]
end
end
…then code outside the contraption can do somecontraption.taketen:"hello" and it will produce an alert.
If your prototype has a get_foo handler with no set_foo, it’ll be read-only; if your prototype has a set_foo with no get_foo, it’ll be write only; if your prototype has both then it behaves like any other variable.
In your case, you probably want your prototype to have a handler like set_image that takes an image and stores it on an internal canvas somewhere (or perhaps a rich text field). Then in the deck outside instead of writing something like this:
# This doesn't work
somecontraption.widgets.storage.paste[mycanvas.copy[]]
…instead you can write something like this:
# This *can* be made to work
somecontraption.image:mycanvas.copy[]
…and inside the prototype:
on set_image val do
if "image" = typeof val
storage.paste[val]
else
show["Tried to store" val "but I need an image"]
end
end
(the show[] just gives you a clue about what might have gone wrong if things don’t work as expected)

