Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Macro Mod basic syntax
- // Comment tags make the entire line into a comment
- // This is a comment
- This is also a comment. // Weird, right?
- // Statements
- if(stuff)
- //stuff
- elseif(morestuff)
- //stuff
- else;
- //stuff
- endif;
- // Variables:
- // Environment
- %ENVIRONMENTAL_STRING%
- %ENRIVONMENTAL_INTEGER%
- ENRIVONMENTAL_BOOLEAN
- // Here's a list of all environmental variables: http://mkb-wiki.herokuapp.com/wiki/variables
- // Defining variables:
- // There are 3 types of user-defined variables: integer, string, and boolean
- // Variables cannot use uppercase!
- // I hate this about Macro Mod
- // Wrong
- #varName = 42
- // Right
- #varname = 42
- // Local (to the current script, NOT the current block)
- &string = "string"
- #integer = 42
- set(boolean)
- unset(boolean)
- // Global (to all scripts, including other Minecraft clients on the same computer)
- @&global_string = "string"
- @#global_integer = 42
- set(@boolean)
- unset(@boolean)
- // set/unset can also be used for strings and integers
- set(&string,"set string to this")
- set(#integer,42)
- // When referencing a user-defined variable, surround it with %%
- &string = "local string"
- log(%&string%)
- // Remember, @ is necessary when referencing a global variable!
- @&gstring = "Global string"
- log(%@&gstring%)
- // Contrary to all logic, variables can be referenced inside quotations.
- // Quotations are essentially identical to lua's tostring method, which is really odd. For example:
- #variable = 42
- log("%#variable%")
- // ..is identical to the following in lua:
- local variable = 42
- print(tostring(variable))
- // The same goes for statements
- #var1 = 42
- &var2 = "42"
- // This will return true
- if("%#var1%" == %&var2%)
- log("True!")
- else;
- log("False!")
- endif;
- // This will return false
- if(%#var1% == %&var2%)
- log("True!")
- else;
- log("False!")
- endif;
- // Loops:
- // Normal loop
- do;
- //stuff
- loop;
- // Loop x times
- do(x);
- //stuff
- loop;
- // FOR loop
- for(#current_iteration,%#start%,%#finish%)
- //stuff
- next;
- // FOREACH
- // http://mkb-wiki.herokuapp.com/wiki/iterators
- // Logs name of each player to chat
- foreach(players,¤t_player)
- log(%¤t_player%)
- next;
- // Arrays also work. Reference the array as "arrayname" with no additional symbols.
- // Split string into array with delimiter ","
- &string = "p1,p2,p3,p4"
- &arrayname = split(",",%&string%)
- // Log each iteration to chat
- foreach(arrayname,¤t_iteration)
- log(%¤t_iteration%)
- next;
- Here's a list of all commands: http://mkb-wiki.herokuapp.com/wiki/commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement