### JavaScript Scripting Metadata Example Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/scripting-metadata This snippet demonstrates the usage of metadata tags in a JavaScript script for the Rise.ai API. These tags provide information like author, version, and description, and control security settings. ```javascript //@ author Codera //@ version 1.0 //@ description A script for testing the API. Includes a test module and a test command. //@ noSecurity /* Disabling the security mesaures, */ /* script might not load due to */ /* Unsafe Script support being disabled */ ``` -------------------------------- ### Settings API Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/objects/module Provides methods to retrieve and modify settings within the Rise 6 environment. Includes functionality to get the current value of a setting and control its visibility. ```APIDOC ## `getSetting(name)` ### Description Retrieves the value of a specified setting. The return type depends on the setting's type (Boolean, String, Number array, Number, or Color array). ### Method `getSetting` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the setting to retrieve. #### Query Parameters None #### Request Body None ### Request Example ```javascript // Example usage (assuming a setting named 'volume' exists) const volume = getSetting('volume'); console.log(volume); ``` ### Response #### Success Response - Returns the setting value. The type can be Boolean, Number[], Number, or String, depending on the setting. - For 'boundsnumber' settings, returns a 2-element array. - For 'color' settings, returns a 4-element array. - For 'mode' settings, returns the mode name (String). #### Response Example ```json { "settingValue": 50 // Example for a 'number' setting } ``` {% hint style="danger" %} If the setting is not found, this method returns null. {% endhint %} ## `setSettingVisibility(name, visible)` ### Description Controls the visibility of a specified setting. This method must be called explicitly to update the visibility. ### Method `setSettingVisibility` ### Parameters #### Path Parameters - **name** (String) - Required - The name of the setting whose visibility is to be changed. - **visible** (Boolean) - Required - `true` to make the setting visible, `false` to hide it. #### Query Parameters None #### Request Body None ### Request Example ```javascript // Example: Hide a setting named 'notifications' setSettingVisibility('notifications', false); ``` ### Response #### Success Response - Returns `Undefined` upon successful execution. #### Response Example ```json { "status": "success" } ``` {% hint style="warning" %} You have to call this method whenever you want to update setting visibility, it does not update automatically. {% endhint %} ``` -------------------------------- ### World - Block Position and Name Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/world Utilities for creating block positions and getting block names. ```APIDOC ## World Block API ### Description Functions for working with block positions and retrieving block names. ### Endpoints #### New Block Position ##### Method POST ##### Endpoint /world/blockpos ##### Request Body - **x** (Number) - Required - The X coordinate. - **y** (Number) - Required - The Y coordinate. - **z** (Number) - Required - The Z coordinate. #### Get Block Name ##### Method GET ##### Endpoint /world/blockname ##### Query Parameters - **blockpos** (Object) - Required - The block position object. - **x** (Number) - Required - The X coordinate. - **y** (Number) - Required - The Y coordinate. - **z** (Number) - Required - The Z coordinate. ### Responses #### Success Response (200) - **newBlockPos**: Returns a `BlockPos` object. - **getBlockName**: Returns the name of the block as a String. ### Request Example (New Block Position) ```json { "x": 10, "y": 64, "z": -25 } ``` ### Response Example (Get Block Name) ```json { "name": "stone" } ``` ``` -------------------------------- ### Get Current GUI Name Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/player Retrieves the name of the Graphical User Interface (GUI) the player is currently interacting with. Returns a string representing the GUI's name. ```javascript getGUI() ``` -------------------------------- ### Handle Game Events in JavaScript Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/examples/events-example This snippet shows how to register a module and attach event handlers for various game events using the Rise Scripting API. It covers events like onAttack, onChatInput, onClick, onKill, onRender2D, onRender3D, onTick, and more. Each handler receives an event object 'e' and logs messages or performs actions based on the event. ```javascript var module = rise.registerModule("Example", "An example description.") script.handle("onUnload", function () { module.unregister() }) // Called when you attack an entity module.handle("onAttack", function(e) { return e }) // Called when you say something in chat module.handle("onChatInput", function(e) { return e }) // Called when the player clicks module.handle("onClick", function(e) { return e }) // Called when the player attacks another entity and recieves hit slowdown module.handle("onHitSlowDown", function(e) { return e }) // Called when you jump module.handle("onJump", function(e) { return e }) // Called when you press a key module.handle("onKeyboardInput", function(e) { return e }) // Called a player is killed by you module.handle("onKill", function(e) { return e }) // Called when movement inputs are accessed module.handle("onMoveInput", function(e) { return e }) // Called pre motion module.handle("onPostMotion", function(e) { return e }) // Called pre motion module.handle("onPreMotion", function(e) { return e }) // Called pre update module.handle("onPreUpdate", function(e) { return e }) // Called when the 2d ui is drawn module.handle("onRender2D", function(e) { return e }) // Called when the 3d world is drawn module.handle("onRender3D", function(e) { return e }) // Called when the player is slowed down by an item module.handle("onSlowDown", function(e) { return e }) // Called at the start of the clients tick module.handle("onTick", function(e) { return e }) // Called when the client references inWater method module.handle("onWater", function(e) { return e }) // Called 20 times per second, just before the players movement is added for the current tick module.handle("onStrafe", function(e) { print("Test") // Prints "Test" to console return e }) ``` -------------------------------- ### Timer Management API Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/mc Functions for getting and setting the timer speed and retrieving tick information. ```APIDOC ## GET /timer/speed ### Description Returns the current timer speed. ### Method GET ### Endpoint /timer/speed ### Parameters None ### Request Example None ### Response #### Success Response (200) - **timerSpeed** (Number) - The current timer speed. #### Response Example { "timerSpeed": 1.0 } ## SET /timer/speed ### Description Sets the timer speed for the game. ### Method POST ### Endpoint /timer/speed ### Parameters #### Request Body - **timerSpeed** (Number) - Required - The desired timer speed. Default value is 1. ### Request Example { "timerSpeed": 2.0 } ### Response #### Success Response (200) - **message** (String) - Confirmation message. #### Response Example { "message": "Timer speed updated successfully." } ## GET /timer/partialTicks ### Description Returns the number of elapsed partial ticks. ### Method GET ### Endpoint /timer/partialTicks ### Parameters None ### Request Example None ### Response #### Success Response (200) - **elapsedPartialTicks** (Number) - The number of elapsed partial ticks. #### Response Example { "elapsedPartialTicks": 0.5 } ## GET /timer/renderPartialTicks ### Description Returns the number of render partial ticks. ### Method GET ### Endpoint /timer/renderPartialTicks ### Parameters None ### Request Example None ### Response #### Success Response (200) - **renderPartialTicks** (Number) - The number of render partial ticks. #### Response Example { "renderPartialTicks": 0.75 } ``` -------------------------------- ### Register and Use Settings in Rise API (JavaScript) Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/examples/example-settings This snippet registers various setting types (number, boundsnumber, string, mode, boolean, color) with default values and demonstrates how to retrieve them within an event handler. It utilizes the rise.registerModule and module.registerSetting functions. The `onUnload` event unregisters the module, and the `onStrafe` event displays the retrieved settings in the chat. ```javascript var module = rise.registerModule("Example Settings", "An example script to teach how to use rise's scriptapi's settings.") module.registerSetting("number"/*Setting Type*/, "Number Setting"/*Setting Name*/, 1 /*Default Value*/, 0.1/*Min Value*/,10/*Max Value*/,0.1/*Increment*/) module.registerSetting("boundsnumber"/*Setting Type*/, "Bounds Number Setting"/*Setting Name*/, 1 /*Default Value*/, 2/*Default Second Value*/, 0.1/*Min Value*/,10/*Max Value*/,0.1/*Increment*/) module.registerSetting("string"/*Setting Type*/, "String Setting"/*Setting Name*/, "Test" /*Default Value*/) module.registerSetting("mode"/*Setting Type*/, "Mode Setting"/*Setting Name*/, "Mode1"/*Default Mode*/, "Mode1", "Mode2", "Mode3") module.registerSetting("boolean"/*Setting Type*/, "Boolean Setting"/*Setting Name*/, true/*Default Value*/) module.registerSetting("color"/*Setting Type*/, "Color Setting"/*Setting Name*/, 255/*Default Red*/, 255/*Default Green*/, 255/*Default Blue*/) script.handle("onUnload", function () { module.unregister() }) module.handle("onStrafe", function(e) { rise.displayChat(module.getSetting("Number Setting")) rise.displayChat(module.getSetting("Bounds Number Setting")) rise.displayChat(module.getSetting("String Setting")) rise.displayChat(module.getSetting("Mode Setting")) rise.displayChat(module.getSetting("Boolean Setting")) }) ``` -------------------------------- ### Damage and Utility Functions Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/player Provides functions for dealing damage (instant or fake), calculating rotations, and checking player states. ```APIDOC ## `itemDamage()` ### Description Damages the player using a snowball/fishing rod/bow. ### Method `Undefined` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "itemDamage()" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `damage(packet, timer)` ### Description Damages the player without an item. ### Method `Undefined` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **packet** (Boolean) - Required - Whether to do instant damage or slow damage. - **timer** (Number) - Optional - Timer for the slow damage. Defaults to 1. ### Request Example ```json { "example": "damage(true, 5)" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `fakeDamage()` ### Description Fake damages the player. ### Method `Undefined` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "fakeDamage()" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `calculateRotations(to)` ### Description Calculates rotations towards an entity or a position in the world. ### Method `Vector2` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **to** (Vector3 or Entity) - Required - Entity or position to calculate rotations to. ### Request Example ```json { "example": "calculateRotations(entity)" } ``` ### Response #### Success Response (200) - **Vector2** - The calculated rotations. #### Response Example ```json { "example": "new Vector2(yaw, pitch)" } ``` ## `getHurtTime()` ### Description Returns the player's hurt time. ### Method `Number` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "getHurtTime()" } ``` ### Response #### Success Response (200) - **Number** - The player's hurt time. #### Response Example ```json { "example": "5" } ``` ``` -------------------------------- ### Command Object Methods Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/objects/command This section covers the methods available on the Command object for interacting with commands. ```APIDOC ## Command Object Methods ### `unregister()` **Description**: Unregisters the command. **Method**: Undefined (This method does not return a value). **Endpoint**: N/A (This is a method of an object, not an API endpoint). ### `getName()` **Description**: Returns the command name. **Method**: String **Endpoint**: N/A (This is a method of an object, not an API endpoint). ### `getDescription()` **Description**: Returns the command description. **Method**: String **Endpoint**: N/A (This is a method of an object, not an API endpoint). ### `handle(type, handler)` **Description**: Adds a handler for a command event. The only supported event type is `onExecute`. **Method**: Undefined (This method does not return a value). **Endpoint**: N/A (This is a method of an object, not an API endpoint). #### Parameters **Query Parameters**: - **type** (String) - Required - The type of event to handle. Currently, only 'onExecute' is supported. - **handler** (function) - Required - The callback function to execute when the event occurs. It accepts an array of strings (`args: String[]`) as parameters and returns `Undefined`. ``` -------------------------------- ### Place Block with Orientation Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/player Places a block in the game world using the item held in the player's main hand. Requires the item stack, block position, the side of the block to place against (0-5), and the hit vector. The 'side' argument corresponds to specific directions: DOWN(0), UP(1), NORTH(2), SOUTH(3), WEST(4), EAST(5). ```javascript placeBlock(heldStack, blockPos, side, hitVec) ``` -------------------------------- ### onExecute Event Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation The main entry point event for script execution. ```APIDOC ## onExecute Event ### Description This event serves as the primary entry point for a script's execution. It is typically called once when the script is loaded or initialized. ### Method Event ### Endpoint `/rise-6-scripting-api/api-documentation/events/onexecute-event.md` ### Parameters N/A (Event-based) ### Request Example N/A (Event-based) ### Response N/A (Event-based) #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Slow Down Event Handling Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/slow-down-event This section details the 'onSlowDown' event, which is triggered when a player is slowed down. It also describes functions to set and get forward and strafe movement multipliers. ```APIDOC ## onSlowDown Event ### Description This event is called when a player is slowed down by blocking or using a consumable item. This event is cancellable. ### Method Event ### Endpoint N/A (Event Handler) ### Parameters None ### Request Example ```lua function onSlowDown(event) -- Event handling logic here if event.isCancellable then event.cancel() end end ``` ### Response #### Success Response None (Event handler) #### Response Example None ## setForwardMultiplier(multiplier) ### Description Sets the amount of forward slowdown to apply. The default value is 0.2. ### Method Function Call ### Endpoint N/A (Scripting Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **multiplier** (Number) - Required - Amount of forward slowdown to apply. ### Request Example ```lua setForwardMultiplier(0.3) ``` ### Response #### Success Response - **Undefined**: This function does not return a value. #### Response Example None ## setStrafeMultiplier(multiplier) ### Description Sets the amount of strafe slowdown to apply. The default value is 0.2. ### Method Function Call ### Endpoint N/A (Scripting Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **multiplier** (Number) - Required - Amount of strafe slowdown to apply. ### Request Example ```lua setStrafeMultiplier(0.25) ``` ### Response #### Success Response - **Undefined**: This function does not return a value. #### Response Example None ## getStrafeMultiplier() ### Description Returns the current strafe slowdown multiplier. ### Method Function Call ### Endpoint N/A (Scripting Function) ### Parameters None ### Request Example ```lua local currentStrafeMultiplier = getStrafeMultiplier() print(currentStrafeMultiplier) ``` ### Response #### Success Response - **Undefined**: Returns the strafe multiplier. #### Response Example ```json { "StrafeMultiplier": 0.2 } ``` ## getForwardMultiplier() ### Description Returns the current forward slowdown multiplier. ### Method Function Call ### Endpoint N/A (Scripting Function) ### Parameters None ### Request Example ```lua local currentForwardMultiplier = getForwardMultiplier() print(currentForwardMultiplier) ``` ### Response #### Success Response - **Undefined**: Returns the forward multiplier. #### Response Example ```json { "ForwardMultiplier": 0.2 } ``` ``` -------------------------------- ### sendInput Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/packet Sends a C0C Input packet for player movement. ```APIDOC ## sendInput ### Description Sends a C0C Input packet for player movement. ### Method POST (or similar, depending on implementation) ### Endpoint /packet/input ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strafeSpeed** (Number) - Required - The player's strafe speed (-1 to 1). - **forwardSpeed** (Number) - Required - The player's forward speed (-1 to 1). - **jumping** (Boolean) - Required - Whether the player is attempting to jump. - **sneaking** (Boolean) - Required - Whether the player is attempting to sneak. ### Request Example ```json { "strafeSpeed": 0.5, "forwardSpeed": 1.0, "jumping": false, "sneaking": false } ``` ### Response #### Success Response (200) - **status** (String) - Indicates success. #### Response Example ```json { "status": "Input packet sent successfully" } ``` ``` -------------------------------- ### Get Slowdown Amount (Rise Scripting API) Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/hit-slow-down-event Retrieves the current slowdown value applied when an entity is attacked. This function returns a number representing the slowdown factor. ```javascript getSlowDown(): Number ``` -------------------------------- ### Module Lifecycle and Information Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/objects/module Methods for unregistering, toggling, and retrieving information about a module. ```APIDOC ## Module Methods ### `unregister()` Unregisters the module. - **Method**: `Undefined` ### `toggle()` Toggles the module. - **Method**: `Undefined` ### `getName()` Returns the module name. - **Returns**: `String` ### `getTag()` Returns the module tag for arraylists. - **Returns**: `String` ### `getCategory()` Returns the module category. - **Returns**: `String` ### `getDescription()` Returns the module description. - **Returns**: `String` ### `isEnabled()` Returns if the module is enabled or not. - **Returns**: `Boolean` ``` -------------------------------- ### Get Forward Movement Slowdown Multiplier (JavaScript) Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/slow-down-event This method retrieves the current forward slowdown multiplier that is applied to the player during the onSlowDown event. This can be used to check existing movement restrictions or for debugging purposes. It returns a number representing the multiplier. ```javascript /** * Returns the forward multiplier. * @returns {Number} The current forward slowdown multiplier. */ getForwardMultiplier() ``` -------------------------------- ### Player Movement Input Handling Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/move-input-event This section covers the `onMoveInput` event and associated functions for controlling player movement. ```APIDOC ## Player Movement Input Event ### Description This event is triggered when the player manually moves. The handler name is `onMoveInput`. ### Method Event Handler ### Endpoint N/A (Event Handler) ### Parameters None directly for the event, but functions below can be called within the handler. ### Request Example ```javascript function onMoveInput() { // Example: Apply forward movement if a condition is met if (someCondition) { player.setForward(1); } } ``` ### Response No direct response for the event itself. ``` ```APIDOC ## Set Forward Movement ### Description Sets the amount of forward movement to apply to the player. ### Method `setForward(forward)` ### Endpoint N/A (Function within event handler) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **forward** (Number) - Required - Amount of forward movement to apply. Default is 1 or 0 if not sneaking. ### Request Example ```javascript player.setForward(1); ``` ### Response #### Success Response (Undefined) This function does not return a value. ``` ```APIDOC ## Set Strafe Movement ### Description Sets the amount of strafe movement to apply to the player. ### Method `setStrafe(strafe)` ### Endpoint N/A (Function within event handler) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strafe** (Number) - Required - Amount of strafe movement to apply. Default is 1 or 0 if not sneaking. ### Request Example ```javascript player.setStrafe(-0.5); ``` ### Response #### Success Response (Undefined) This function does not return a value. ``` ```APIDOC ## Set Jump State ### Description Sets the jump state for the player. ### Method `setJump(jump)` ### Endpoint N/A (Function within event handler) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **jump** (Boolean) - Required - Whether to jump or not. Default is false if the jump key is not held. ### Request Example ```javascript player.setJump(true); ``` ### Response #### Success Response (Undefined) This function does not return a value. ``` ```APIDOC ## Set Sneak State ### Description Sets the sneaking state for the player. ### Method `setSneak(sneak)` ### Endpoint N/A (Function within event handler) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **sneak** (Boolean) - Required - Whether to sneak or not. Default is false if the sneak key is not held. ### Request Example ```javascript player.setSneak(true); ``` ### Response #### Success Response (Undefined) This function does not return a value. ``` ```APIDOC ## Set Sneak Slowdown Multiplier ### Description Sets the amount of sneak slowdown multiplier. ### Method `setSneakSlowDownMultiplier(multiplier)` ### Endpoint N/A (Function within event handler) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **multiplier** (Number) - Required - Amount of sneak slowdown multiplier to apply. Default is 0.3 if not sneaking. ### Request Example ```javascript player.setSneakSlowDownMultiplier(0.15); ``` ### Response #### Success Response (Undefined) This function does not return a value. ``` ```APIDOC ## Get Forward Movement ### Description Retrieves the current amount of forward movement applied to the player. ### Method `getForward()` ### Endpoint N/A (Function within event handler) ### Parameters None ### Request Example ```javascript const currentForward = player.getForward(); console.log('Current forward movement:', currentForward); ``` ### Response #### Success Response (Number) - **forwardMovement** (Number) - The current forward movement value. #### Response Example ```json { "forwardMovement": 1 } ``` ``` ```APIDOC ## Get Strafe Movement ### Description Retrieves the current amount of strafe movement applied to the player. ### Method `getStrafe()` ### Endpoint N/A (Function within event handler) ### Parameters None ### Request Example ```javascript const currentStrafe = player.getStrafe(); console.log('Current strafe movement:', currentStrafe); ``` ### Response #### Success Response (Number) - **strafeMovement** (Number) - The current strafe movement value. #### Response Example ```json { "strafeMovement": -1 } ``` ``` ```APIDOC ## Get Sneak Slowdown Multiplier ### Description Retrieves the current sneak slowdown multiplier. ### Method `getSneakSlowDownMultiplier()` ### Endpoint N/A (Function within event handler) ### Parameters None ### Request Example ```javascript const currentMultiplier = player.getSneakSlowDownMultiplier(); console.log('Current sneak slowdown multiplier:', currentMultiplier); ``` ### Response #### Success Response (Number) - **multiplier** (Number) - The current sneak slowdown multiplier. #### Response Example ```json { "multiplier": 0.3 } ``` ``` ```APIDOC ## Is Jump State ### Description Checks if the player is set to jump. ### Method `isJump()` ### Endpoint N/A (Function within event handler) ### Parameters None ### Request Example ```javascript if (player.isJump()) { console.log('Player is set to jump!'); } ``` ### Response #### Success Response (Boolean) - **isJumping** (Boolean) - True if the player is set to jump, false otherwise. #### Response Example ```json { "isJumping": true } ``` ``` ```APIDOC ## Is Sneak State ### Description Checks if the player is set to sneak. ### Method `isSneak()` ### Endpoint N/A (Function within event handler) ### Parameters None ### Request Example ```javascript if (player.isSneak()) { console.log('Player is sneaking!'); } ``` ### Response #### Success Response (Boolean) - **isSneaking** (Boolean) - True if the player is set to sneak, false otherwise. #### Response Example ```json { "isSneaking": false } ``` ``` -------------------------------- ### Get Strafe Movement Slowdown Multiplier (JavaScript) Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/slow-down-event This method returns the current strafe slowdown multiplier active during the onSlowDown event. It allows developers to query the existing strafe slowdown value, which is helpful for monitoring and troubleshooting player movement mechanics. The method returns a number. ```javascript /** * Returns the strafe multiplier. * @returns {Number} The current strafe slowdown multiplier. */ getStrafeMultiplier() ``` -------------------------------- ### Send Client Settings Packet Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/packet Sends a C15 ClientSettings packet. This function has no parameters and sends default or current client settings. ```javascript sendSettings() ``` -------------------------------- ### Module Settings Management Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/objects/module Methods for enabling/disabling modules and managing module settings. ```APIDOC ## `setEnabled(enabled)` Enables/disables the module. ### Method `Undefined` ### Parameters #### Path Parameters - **enabled** (Boolean) - Required - Whether the module will be enabled. ## `registerSetting(type, name, defaultValue, ...params)` Registers a setting to the module. ### Method `Undefined` ### Parameters #### Path Parameters - **type** (String) - Required - The type of setting to register. Currently supported types are: `string`, `number`, `boundsnumber`, `boolean`, `color`, or `mode`. - **name** (String) - Required - Setting name. - **defaultValue** (See the description) - Required - Default value for the setting. Type is: `string` for string settings and mode setting, `Number` for `number`, `boundsnumber` settings, `Boolean` for `boolean` settings, and 3 or 4 element `Number` array for color settings, with the elements corresponding to RGBA. - **params...** (Vararg `any`) - Optional - Additional parameters. See below. ### Description For the `number` setting, the first and second additional parameters are minimum and maximum bounds for the setting, while the third one is for the decimal places (not required, defaults to 2 decimal places.) Default value type is JS Number. For the `boundsnumber` setting, the first additional parameters argument is the second default value. 2nd and 3rd arguments are minimum and maximum bounds for both of the numbers. The last parameter is step size for the setting. Default value type is JS Number. For the `boolean` and `string` settings, the additional parameters do not exist. Default values for them correspond to their JavaScript types. For the `color` setting, there are no additional parameters. Default value type is a 3 or 4 element array, with the elements corrseponding to the RGB(A) channel values. 4th element for the Alpha channel in the array is not required. For the `mode` setting, the additional parameters are all the sub-modes. ## `setSetting(name, value)` Sets a setting of the module. ### Method `Undefined` ### Parameters #### Path Parameters - **name** (String) - Required - Setting name. - **value** (See the description) - Required - The new value for the setting. Type is: `string` for string settings and mode setting, `Number` for `number`, `boundsnumber` settings, `Boolean` for `boolean` settings, and 3 or 4 element `Number` array for color settings, with the elements corresponding to RGBA. ### Description Read the doucmentation for the method above to see more information. ``` -------------------------------- ### Mouse and Attack Functions Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/player Provides functions for basic mouse clicks, attacking entities, and swinging held items. ```APIDOC ## `leftClick()` ### Description Clicks the left mouse button. ### Method `Undefined` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "leftClick()" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `rightClick()` ### Description Clicks the right mouse button. ### Method `Undefined` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "rightClick()" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `attackEntity(target)` ### Description Attacks the target entity. ### Method `Undefined` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **target** (EntityLiving) - Required - The entity to attack. ### Request Example ```json { "example": "attackEntity(targetEntity)" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ## `swingItem()` ### Description Swings the currently held item. ### Method `Undefined` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "swingItem()" } ``` ### Response #### Success Response (200) Undefined #### Response Example ```json { "example": "undefined" } ``` ``` -------------------------------- ### Server Information Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/network Retrieve details about the connected server, including its IP address, name, and Message Of The Day (MOTD). ```APIDOC ## Server Information ### Description These methods provide information about the server the client is currently connected to. If not connected to a server, they return `null`. ### `getServerIP(): String` Returns the IP address of the server if connected, otherwise returns `null`. ### `getServerName(): String` Returns the name of the server if connected, otherwise returns `null`. ### `getServerMOTD(): String` Returns the Message Of The Day (MOTD) of the server if connected, otherwise returns `null`. ### Request Example ```javascript const ip = getServerIP(); const name = getServerName(); const motd = getServerMOTD(); if (ip !== null) { console.log(`Server IP: ${ip}`); console.log(`Server Name: ${name}`); console.log(`Server MOTD: ${motd}`); } else { console.log("Not connected to a server."); } ``` ### Response #### Success Response (String or Null) - Returns a string containing the requested server information, or `null` if not connected. #### Response Example ```json // For getServerIP(): "192.168.1.100" // For getServerName(): "My Awesome Server" // For getServerMOTD(): "Welcome to the server!" // If not connected: null ``` ``` -------------------------------- ### Event Handling API Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events This section describes how to handle events and provides details on cancellable events. ```APIDOC ## Event Handling ### Description To handle an event, call the `handle(handlerName: String, handlerFunction: Function(Event)): Undefined` method on an object that you want your handler to run on. (example: your module, command, the entire script). ### Method `handle(handlerName: String, handlerFunction: Function(Event)): Undefined` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "example": "// Example of handling an event on a module" } ``` ### Response #### Success Response (200) - **Undefined**: The method does not return a value. #### Response Example ```json { "example": "// No specific response body for this operation" } ``` ## Cancellable Events ### Description Some events can be cancelled, while other events can't be. Cancellable events have 2 methods that non-cancellable events don't. ### `isCancelled(): Boolean` Returns if the event has been cancelled or not. ### Method `isCancelled(): Boolean` ### Endpoint (Applies to specific cancellable event objects) ### Parameters None ### Request Example ```json { "example": "// Example of checking if an event is cancelled" } ``` ### Response #### Success Response (200) - **Boolean**: `true` if the event is cancelled, `false` otherwise. #### Response Example ```json { "example": "true" } ``` ### `setCancelled(cancelled): Undefined` Sets the cancelled state of the event. ### Method `setCancelled(cancelled: Boolean): Undefined` ### Endpoint (Applies to specific cancellable event objects) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **cancelled** (Boolean) - Required - The new cancelled state for the event. ### Request Example ```json { "example": "// Example of setting an event to cancelled" } ``` ### Response #### Success Response (200) - **Undefined**: The method does not return a value. #### Response Example ```json { "example": "// No specific response body for this operation" } ``` ## Event Handler Name ### Description This method returns the Event Handler name. ### `getHandlerName(): String` ### Method `getHandlerName(): String` ### Endpoint (Applies to specific event objects) ### Parameters None ### Request Example ```json { "example": "// Example of getting the handler name" } ``` ### Response #### Success Response (200) - **String**: The name of the event handler. #### Response Example ```json { "example": "MyEventHandlerName" } ``` ``` -------------------------------- ### Entity Methods Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/objects/entity This section details various methods available for interacting with entity objects. ```APIDOC ## Entity Methods ### isLiving() Returns if the entity is instance of LivingEntity. ### getPosition() Returns the entity position. ### getLastPosition() Returns the previous tick entity position. ### getMotion() Returns the entity motion. ### getRotation() Returns the entity rotation. ### setYaw(yaw) Sets the entities yaw. ### setPitch(pitch) Sets the entities pitch. ### getLastRotation() Returns the previous tick entity rotation. ### getTicksExisted() Returns the amount of ticks the entity has existed for. ### getEntityId() Returns the entity ID. ### getDisplayName() Returns the entity display name. ### getInventory() Returns the inventory of the entity. ### getDistanceToEntity(entity) #### Parameters ##### Path Parameters - **entity** (Entity) - Required - Another entity. Returns distance between this and another entity. ### getDistance(x, y, z) #### Parameters ##### Path Parameters - **x** (Number) - Required - X position. - **y** (Number) - Required - Y position. - **z** (Number) - Required - Z position. Returns the distance between this entity and the specified position. ``` -------------------------------- ### Jump Event API Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/events/module-events/jump-event This section details the methods available for the 'onJump' event, allowing scripts to interact with player jumping actions. ```APIDOC ## onJump Event ### Description This event is called when the player jumps. It is a cancellable event. ### Methods #### `getYaw(): Number` ##### Description Returns the current yaw rotation of the player. ##### Method GET ##### Endpoint N/A (Event handler method) ##### Response * **yaw** (Number) - The current yaw rotation. #### `setYaw(yaw): Undefined` ##### Description Sets the player's yaw rotation. ##### Method POST ##### Endpoint N/A (Event handler method) ##### Parameters * **Path Parameters** None * **Query Parameters** None * **Request Body** - **yaw** (Number) - Required - The yaw rotation to set. ##### Request Example ```json { "yaw": 90.0 } ``` ##### Response No specific response body for success, operation is performed. #### `setJumpMotion(motion): Undefined` ##### Description Applies a specific motion to the player's jump. ##### Method POST ##### Endpoint N/A (Event handler method) ##### Parameters * **Path Parameters** None * **Query Parameters** None * **Request Body** - **motion** (Number) - Required - The jump motion to apply. ##### Request Example ```json { "motion": 5.0 } ``` ##### Response No specific response body for success, operation is performed. #### `getYaw(): Number` ##### Description Returns the current jump yaw. ##### Method GET ##### Endpoint N/A (Event handler method) ##### Response * **yaw** (Number) - The current jump yaw. ``` -------------------------------- ### Pre Update Event Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation Handles events that occur before the main game update loop, useful for early frame logic. ```APIDOC ## onPreUpdate Event ### Description This event is triggered at the beginning of the game's update cycle for each frame. It's suitable for logic that needs to execute before most other game systems update. ### Method Event ### Endpoint `/rise-6-scripting-api/api-documentation/events/module-events/pre-update-event.md` ### Parameters N/A (Event-based) ### Request Example N/A (Event-based) ### Response N/A (Event-based) #### Success Response (N/A) N/A #### Response Example N/A ``` -------------------------------- ### Display Information API Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/mc Provides functions to retrieve the display dimensions of the game window. ```APIDOC ## GET /display/width ### Description Returns the display width of the game window. ### Method GET ### Endpoint /display/width ### Parameters None ### Request Example None ### Response #### Success Response (200) - **displayWidth** (Number) - The current width of the game display. #### Response Example { "displayWidth": 1920 } ## GET /display/height ### Description Returns the display height of the game window. ### Method GET ### Endpoint /display/height ### Parameters None ### Request Example None ### Response #### Success Response (200) - **displayHeight** (Number) - The current height of the game display. #### Response Example { "displayHeight": 1080 } ``` -------------------------------- ### Player State and Movement Functions Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation/global-namespaces/player Functions to check various player states like using items, holding specific items, and movement input. ```APIDOC ## `isUsingItem()` ### Description Returns whether the player is currently using an item. ### Method `Boolean` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "isUsingItem()" } ``` ### Response #### Success Response (200) - **Boolean** - True if the player is using an item, false otherwise. #### Response Example ```json { "example": "true" } ``` ## `isHoldingSword()` ### Description Returns whether the player is holding a sword. ### Method `Boolean` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "isHoldingSword()" } ``` ### Response #### Success Response (200) - **Boolean** - True if the player is holding a sword, false otherwise. #### Response Example ```json { "example": "true" } ``` ## `isHoldingTool()` ### Description Returns whether the player is holding a tool. ### Method `Boolean` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "isHoldingTool()" } ``` ### Response #### Success Response (200) - **Boolean** - True if the player is holding a tool, false otherwise. #### Response Example ```json { "example": "true" } ``` ## `isHoldingBlock()` ### Description Returns whether the player is holding blocks. ### Method `Boolean` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "isHoldingBlock()" } ``` ### Response #### Success Response (200) - **Boolean** - True if the player is holding blocks, false otherwise. #### Response Example ```json { "example": "false" } ``` ## `getFoward()` ### Description Returns a value depending on if forward or backwards movement keys are pressed. ### Method `Number` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "getFoward()" } ``` ### Response #### Success Response (200) - **Number** - 1 if moving forward, -1 if moving backward, 0 otherwise. #### Response Example ```json { "example": "1" } ``` ## `getStrafe()` ### Description Returns a value depending on if left or right movement keys are pressed. ### Method `Number` ### Endpoint N/A ### Parameters None ### Request Example ```json { "example": "getStrafe()" } ``` ### Response #### Success Response (200) - **Number** - 1 if moving right, -1 if moving left, 0 otherwise. #### Response Example ```json { "example": "-1" } ``` ``` -------------------------------- ### Keyboard Input Event Source: https://riseclients-organization.gitbook.io/rise-6-scripting-api/api-documentation Handles keyboard input events, allowing scripts to react to key presses and releases. ```APIDOC ## onKeyboardInput Event ### Description This event is triggered when a keyboard input occurs. It allows scripts to capture and process key presses. ### Method Event ### Endpoint `/rise-6-scripting-api/api-documentation/events/module-events/keyboard-input-event.md` ### Parameters N/A (Event-based) ### Request Example N/A (Event-based) ### Response N/A (Event-based) #### Success Response (N/A) N/A #### Response Example N/A ```