• Hey! Register here to create your account, engage with the community, and talk about what is new!

Text Codes

RyanLand

Active member
Overlord
Joined
Sep 6, 2020
Messages
59
Reaction score
38
Text Codes may be confusing at first, but once you know how they work, they can be extremely useful!

Essentially text codes change the name of a variable, making it dynamic. It changes the name, not the value.

For example, say we have a variable called %default money. The variable you're using here is actually RyanLand money, because that's the name of the default target.

All text codes can also be nested inside of eachother.

Here's a spoiler of all available text codes and their explanations:

  • %damager
The name of the damager target in this event. Only works in damage events.
  • %default
The name of the default target in this event.
  • %index( list variable name , index )
Gets the value from the index provided. Example:
list = [ a, b, c ]
ad = 100
%index(list,1)d returns 100
  • %killer
The name of the killer target in this event. Only works with kill events.
  • %math( expression )
Returns the output of a mathematical expression.
Does not follow PEMDAS/OoO. Supports the following operations:
  1. Sum (+)
  2. Difference (-)
  3. Product (*)
  4. Quotient (/)
  5. Remainder (%)
  • %projectile
The name of the projectile in this event. Only works with projectile events.
  • %random( minimum , maximum )
Gives a random number with a rounding multiple of 1 between and including the minimum and maximum.
  • %round( number to round )
Floors the given value.
  • %selected
The name of the selected object. To clear up confusion: Multiple objects being selected will run code for every object in the selection, %selected would return the name of the object running the code, which is different for every object when using selections bigger than one.
  • %shooter
The shooter of the projectile in this event. Only works with projectile events if the projectile was launched by a player (including have used Player Action: Launch Projectile). Also applies to other entities.
  • %uuid
Identical to %selected, but instead, gets the UUID instead of the name. A UUID is unique to every player account and entity.
  • %var( variable name )
Returns the value of the variable. Example:
a = 1
1b = 2
%var(a)b returns 2
  • %victim
The name of the victim in this event. Only works in damage events.

Hope this helped you, and feel free to ask any questions! :)
 
Last edited:

EmeralDev

Forum adept
Joined
Sep 7, 2020
Messages
193
Reaction score
30
%victim can also work in click player/click entity events
 
Top Bottom