Skip to content

Procedures & Functions

OfficialDonut edited this page Jan 2, 2022 · 3 revisions

Procedures and functions are used to run code when they are executed. They are useful for running the same code in different parts of your plugin so the code does not have to be written multiple times. The difference between them is that a procedure simply executes the code whereas a function also returns a value.

Defining Procedure/Function

To define a procedure use the [VB] Procedure plugin component and set the name in the textfield then connect the blocks you want to be executed to the procedure block. Similar to command arguments, use the [VB] Procedure Argument block to access any arguments that are passed to the procedure (argument indices start at 0).

The Function block works the same way except the [VB] Function Return block is used to return a value.

Executing Procedure/Function:

To execute a procedure use the [VB] Execute Procedure block and type the name of the procedure that you want to execute in the textfield. Put a list containing any arguments that you want to be passed to the procedure in the arguments field.

To execute a function and get the value returned by it use the [VB] Function Value block. Just like with procedures, put a list containing any arguments that you want to be passed to the function in the arguments field.

Procedure Example


Function Example


VisualBukkit Discord: https://discord.gg/ugkvGpu

Clone this wiki locally