1. create your block
At first, you have to build your own block. There is nothing special to consider in this step. Simply click on "Make a shared block" and build your block, as you are used to. The purpose of a C-block is to do something with code, in this particular case I show you how to use this block to execute code from another object. The function to do this, is called "launch".
Here is my block:
Code: Select all
to launchFor obj cmd {
launch (global 'page') (newCommand 'call' (function cmd) obj) obj
}
After you've finished your block, export it. This is only posible in developer mode. Now open your exported file with your prefered texteditor.
It should now look like this:
Code: Select all
spec ' ' 'launchFor' 'launchFor _ _' 'auto auto' '10' '10'
to launchFor obj cmd {
launch (global 'page') (newCommand 'call' (function cmd) obj) obj
}
defineClass LaunchFor morph
script 'LaunchFor' 50 50 {
to launchFor {}
}
The 'auto auto' attribut defines the types of your input fields. In this case we want to launch code for other objects. So change the first "auto" to "obj". Our second input should be the code which we want to execute. You have to set the second "auto" to "cmd". At least, remove the last two arguments, those are only default values. You first line should now look like this:
Code: Select all
spec ' ' 'launchFor' 'launchFor _ _' 'obj cmd'