TrMenu
PurchaseGithubLicense
English
English
  • Home
  • Start
    • Install
    • Setup
  • Migrate
  • MENU
    • Structure
      • Title
      • Layout
      • Options
      • Bindings
      • Events
      • Buttons
      • Built-in Scripts
      • Tasks
    • Icons
      • Update
      • Refresh
      • Display
        • Material
        • Name
        • Lore
        • Amount
        • Glow
        • Flags
        • NBT
      • Actions
      • Priority
      • Condition
      • Inherit
  • ACTIONS
    • Types
      • Command (as Player)
      • Command (as OP)
      • Command (as CONSOLE)
      • Player's chat
      • Message
      • Tellraw
      • ActionBar
      • Title/SubTitle
      • Sound
      • Bungee Server
      • JavaScript
      • Input Catcher
        • Re-Enter
      • Useful
        • Delay
        • Break
      • Items
        • Take-Items
        • Give-Item
        • Enchant-Item
        • Repair-Item
      • Economy
        • Give-Money
        • Take-Money
        • Set-Money
        • Give-Points
        • Take-Points
        • Set-Points
      • Menu
        • Close
        • Close (Silent)
        • Open
        • Page
        • Set-Args
        • Set-Title
        • Refresh
      • Datas
        • Set-Meta
        • Rem-Meta
        • Set-Data
        • Rem-Data
    • Options
      • Delay
      • Condition
      • Chance
      • All Players
    • Action
  • SCRIPT
    • Expressions
      • stringEquals
      • stringEqualsIgnoreCase
      • isNumber
      • isOperator
      • isPlayerOperator
      • hasPermission
      • hasLevel
      • hasMoney
      • hasPoints
      • hasItem
    • Scripts
  • FUNCTIONS
    • Arguments
    • Item Identifiers
    • Script Placeholder
    • Register Commands
    • Shortcuts
    • Commands
  • HOOK
    • PlaceholderAPI
    • Cronus
    • Vault
    • PlayerPoints
    • HeadDatabase
    • Oraxen
    • SkinsRestorer
  • API
    • TrMenuAPI
    • Events
      • MenuOpenEvent
      • MenuCloseEvent
      • MenuClickEvent
    • MenuFactory
Powered by GitBook
On this page
  • Examples
  • Usage

Was this helpful?

  1. MENU
  2. Structure

Built-in Scripts

Built-in scripts which can be called quickly and easily in the menu.

Examples

Script without arguments
#
# A simple custom script
# The returned value can be obtained with ${ID_OF_THE_SCRIPT}
#

Functions:
  health: |-
    function health(){
      return player.getHealth()
    }
    health()
Script with arguments
#
# You can create a script wich requires arguments 
# You can specify them with ${ID_arg1_arg2_...} 
# and use them in the script with {0}, {1}, ....
#

Functions:
  flash: |-
    function flash() {
      var parsed = "%animations_<flash>{0}</flash>%"
      return parsed.isEmpty() ? utils.emptyString("{0}".length()) : parsed
    }
    flash()

Usage

  • Each script must have a unique identifier

  • You can use ${SCRIPT_IDENTIFIER} to get the value returned by a script

  • You can use arguments with `${IDENTIFIER_ARG1_ARG2} and then get the value in the script with {0}, {1}...

  • Since you have to use {0} for *scripts*' arguments, you have to use PlaceholderAPI placeholders to get the menu's arguments: %trmenu_args_0%,%trmenu_args_1%, %trmenu_args_2%...

'Health':
  update: 20
  display:
    material: RED_STAINED_GLASS_PANE
    name: 'Health'
    lore:
    - ''
    - '&cHealth: ${health}'
    - ''
  actions:
    all: 'close'
# ...
lore:
 - '&b${flash_➥} &3Left-Click &7to display more info.'
PreviousButtonsNextTasks

Last updated 4 years ago

Was this helpful?