i suggest that you just learn thyme, it took me about ~6 months to master it.
also put in the desired balls object console, should look like ████████████ under Algodoo scripting is for advanced users only and is an unsupported feature. Use at own risk!
for the 2nd one:
you need 2 global variables (or whatever)
add a box (the one you showed)
here is an example for the 1st ball having the variable scene.my.pos and the other having scene.my.pos1
poststep = (e)=>{
p0 := scene.my.pos //may change;
p1 := scene.my.pos1 //may change;
size = [math.vec.dist(p0, p1) + size(1), size(1)];
pos = (p0 + p1) * 0.5;
angle = math.atan2(p1(1) - p0(1), p1(0) - p0(0))
}
hope it helps
edit: i suggest using the chrome version of algobox since it'd be much easier to copy & paste instead of writing it manually