ObjectGears Help

           
Forum   ObjectGears (Version: 1.6.0.0)

Script blocks

Script blocks are used for placing parts of scripts that are used repeatedly to a single place. You get several advantages by setting parts of scripts aside:

  • More simple code in the place from where you call
  • Centralizing common functions in a single place
  • Your code will be maintained in a better way

Script blocks are visible from all the models and can be used in all the scripts.

Only enabled blocks can be used. This can be benefit in case of a fast replacement of a complete functionality for another one. You switch off one block, switch on the new prepared one, change the code of the old block and use the orinal code of the old block for the new block.

Rules for code

When creating script blocks pay attention to the code of the script block. The code is unique over the whole ObjectGears system and we do not recommend to change it with regard to its use in scripts. If you need to change it, use the functionality search in scripts and functions to make sure you change it also in all the places where it is used.

We recommend using prefix in the code for your blocks. This helps to avoid collisions with other blocks from future models.

Use

Before using block in your script you have to state script block definition. Put this definition at the beginning of the script. When using more blocks put them on separate lines.

 

The first line contains definition of the used script block with code f1. The second line then calls method F1, that is contained in the given block.

//#block f1
F1();

 

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information