Functions

Functions are the core item of BlockScript. This page highlights some of the core features and concepts of a Function.

</br>

Basic Function Controls

When you start on BlockScript, an example Function will be generated. You may edit this freely.

Create a new Function:

  • Select 'Functions' in the sidebar
  • Click 'Add New'

Deleting a Function

  • Select 'Settings' in the sidebar
  • Click 'Delete Function'
  • Enter the Function name in the confirmation modal
  • Click 'Delete'.

Please Note: Deleting is irreversible and cannot be undone

Rename a Function

  • Select 'Settings' in the sidebar
  • Edit the 'Name' field
  • Click 'Save' in the sidebar

Saving a Function

Saving a Function occurs when performing a number of actions such as:

  • Running the Function
  • Enabling Cloud Execution/ Scheduling/ REST API

However if you wish to save manually:

  • Click 'Save' in the sidebar

</br>

Parameters and Return type

Parameters determine the data a Function takes in. To edit Parameters:

  • Click 'Parameters' in the sidebar
  • Use 'Add Start Parameter' to add a new Parameter
  • Set the name using the upper field of each Parameter
  • Set the type of the Parameter using the dropdown in the lower field
  • Use 'Delete Start Parameter' to delete a Parameter

Return Type determines the result data type of a Function. To change the Return Type of a Function:

  • Click 'Parameters' in the sidebar
  • Select the Return type under the 'Return Block Type' dropdown

<img width="300" src="/assets/images/parameters.png" />

</br>

Locked Settings/ Parameters

When using a Function inside another Function, this will cause the settings and Parameters to lock to prevent changes.

<img width="300" src="/assets/images/parameterLocked.png" />

</br>

Cloud Execution

Under 'Settings' in sidebar. This is a premium feature which allows you to execute your code in the cloud. This also allows for other features such as Function Scheduling or our <a href="/api">REST API</a>. Please check https://blockscript.app homepage premium section for usage limits and pricing.

</br>

REST API

Under 'Settings' in sidebar. This is a premium feature which allows you to run Functions using our <a href="/api">REST API</a>. Read more about it <a href="/api">here</a>.

</br>

Schedule

Under 'Settings' in sidebar. This is a premium feature which allows running of Functions based on a <a href="https://crontab.guru/">CRON</a> schedule. Maximum frequency, every minute.

Please note: Scheduled Functions will have no Start Parameters available.

</br>

Running a Function

  • Click 'Run' in the sidebar.
  • Fill in each parameter with the required data type
  • Click the 'Save and Run' button

<img width="600" src="/assets/images/running.png" />