# Logging - Part 2: Function Block Setup

### 1. Control Function Block:

The control [function block](https://docs.intrepidcs.com/vspy-3-documentation/3.9.15/vehicle-spy-main-menus/main-menu-scripting-and-automation/function-blocks/function-blocks-types/script-type-function-block) is a script that will tell the capture function block to change partitions when the trigger condition is met. There are a number of ways to do this script. The basic functionality would be to:\\

1. Set your index
2. Wait for condition to change partition
3. Change partition
4. Make sure you are accessing a valid partition

The script in the example is shown below.

![](https://2396693198-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlRJv2XDCMeZSU0VbeZlG%2Fuploads%2Fgit-blob-e20cba3dcf0eb49314dba2d5dd0039b9d6ca97b8%2FappnotCMPartControl.gif?alt=media)
