scripting
Scripting is used to create custom placeholders (i.e. the stuff in the "script" folder). Remember that updating custom placeholders will take a lot longer than the ones coded in, so if you think other people might find it useful, send me a PM or use the TICKETS tab to request it.
Scripts can be found as a ".yml" file inside the "scripts" folder for ScriptingPlus+
Returning values
Simply use the return keyword, followed by the value you want to return (example below)
script: - "if {itemid} = 10" - "return AAH LAVA!" - "else" - "return Hi"
Results longer than one line will automatically go to the next line if it's free
You can also force a line split with \n
Additional Placeholders
In custom placeholders, you can now have modifiers e.g. putting {example:A:B:C} on a sign
These modifiers will replace the following placeholders:
- {arg1}
- {arg2}
- etc.
For example:
- {arg1} will return A for the custom placeholder {example:A:B:C}
Keywords
Keywords will do something functional, and may accept arguments.
A keyword must be at the start of a line
if
Code following an if statement will only happen if the expression (e.g. if 1+1=2) is true
- Accepts + - / * - Brackets can be used: if (1+2)*3 = 9 - Placeholders are evaluated Relations: != (does not equal) >= (greater than or equal to) <= (less than or equal to) =~ (equals string, case insensitive) = (equals, case sensitive) > (greater than, or longer than) < (less than, or shorter than)
else
- Will trigger when an if statement returns false
e.g.
if {player} = bob hi notch else you aren't bob :(
endif
- Indicates the end of an if/else block
if true \it's true you know endif \I am no longer in the if statement
for
Can loop through a list, or just for a set amount of time
e.g. "for 10;cmdcon say test"
LISTS
- for i:1,2,3,4,5,6;cmdcon say {i}
- Some placeholders are lists e.g. {online}
- You can leave the "i" part blank if you don't want to set a temporary variable
endloop
- Indicates what is inside the for loop (and what is outside - after the endloop)
e.g.
for 10 \spam you are spamming endloop \I am no longer in the for loop and thus not spamming
gvar
Set a variable using gvar.
e.g. "gvar test 5"
now you can use {test} and it will return 5
do
Has the user execute a command
do spawn
^ will have you teleport to spawn
cmd
Exactly like do
cmdop
Has the user execute a command as op regardless of the script elevation
cmdop stop
^ will have you stop the server cause it's fun
cmdcon
Has the console execute a command for you regardless of the script elevation
cmdcon ban notch
^ will have the console ban notch
\
Will have you send a chat message
\This is a chat message
setuser
Will change the user to another online player.
setuser Notch {player}
Will print out Notch's name rather than yours
return
Will return a value - e.g. "return true"
msg
sends the current user a chat message
e.g. "msg Hello there"
- Will send the message to console if there is no current user
after
schedule a script to run (as the player if possible) after a set amount of time
e.g."after 10s do spawn"
schedule
schedule a script to run (as console) after a set amount of time (survives restarts)
e.g. "schedule 3d15h6s say yo"
^ will have the console say yo in 3 days, 15 hours and 6 seconds
Comments