By default, when you create a box its script looks as follows:
The topic name is created using the name you gave to the box, and the language is the one you have selected during box creation.
To add rules, see the syntax here: QiChat - Syntax.
You can also pick chunk of code using the auto-completion tool: use Ctrl-Space to display it.
Note that when a long name is splitted by slashes / (like $Device/SubDeviceList/Battery/Current/Sensor/Value), the auto-completion tool allows you select it chunk by chunk.
Follow step by step the tutorials: Creating Dialog boxes.