Advertisement
Sanwiches

How to Macro Mod

Jan 17th, 2015
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. // Macro Mod basic syntax
  2.  
  3. // Comment tags make the entire line into a comment
  4. // This is a comment
  5. This is also a comment. // Weird, right?
  6.  
  7. // Statements
  8.  
  9. if(stuff)
  10. //stuff
  11. elseif(morestuff)
  12. //stuff
  13. else;
  14. //stuff
  15. endif;
  16.  
  17. // Variables:
  18. // Environment
  19. %ENVIRONMENTAL_STRING%
  20. %ENRIVONMENTAL_INTEGER%
  21. ENRIVONMENTAL_BOOLEAN
  22.  
  23. // Here's a list of all environmental variables: http://mkb-wiki.herokuapp.com/wiki/variables
  24.  
  25. // Defining variables:
  26. // There are 3 types of user-defined variables: integer, string, and boolean
  27.  
  28. // Variables cannot use uppercase!
  29. // I hate this about Macro Mod
  30. // Wrong
  31. #varName = 42
  32.  
  33. // Right
  34. #varname = 42
  35.  
  36. // Local (to the current script, NOT the current block)
  37.  
  38. &string = "string"
  39. #integer = 42
  40. set(boolean)
  41. unset(boolean)
  42.  
  43. // Global (to all scripts, including other Minecraft clients on the same computer)
  44.  
  45. @&global_string = "string"
  46. @#global_integer = 42
  47. set(@boolean)
  48. unset(@boolean)
  49.  
  50. // set/unset can also be used for strings and integers
  51.  
  52. set(&string,"set string to this")
  53. set(#integer,42)
  54.  
  55. // When referencing a user-defined variable, surround it with %%
  56.  
  57. &string = "local string"
  58. log(%&string%)
  59.  
  60. // Remember, @ is necessary when referencing a global variable!
  61.  
  62. @&gstring = "Global string"
  63. log(%@&gstring%)
  64.  
  65. // Contrary to all logic, variables can be referenced inside quotations.
  66. // Quotations are essentially identical to lua's tostring method, which is really odd. For example:
  67.  
  68. #variable = 42
  69. log("%#variable%")
  70.  
  71. // ..is identical to the following in lua:
  72.  
  73. local variable = 42
  74. print(tostring(variable))
  75.  
  76. // The same goes for statements
  77.  
  78. #var1 = 42
  79. &var2 = "42"
  80.  
  81. // This will return true
  82. if("%#var1%" == %&var2%)
  83. log("True!")
  84. else;
  85. log("False!")
  86. endif;
  87.  
  88. // This will return false
  89. if(%#var1% == %&var2%)
  90. log("True!")
  91. else;
  92. log("False!")
  93. endif;
  94.  
  95. // Loops:
  96.  
  97. // Normal loop
  98.  
  99. do;
  100. //stuff
  101. loop;
  102.  
  103. // Loop x times
  104.  
  105. do(x);
  106. //stuff
  107. loop;
  108.  
  109. // FOR loop
  110.  
  111. for(#current_iteration,%#start%,%#finish%)
  112. //stuff
  113. next;
  114.  
  115. // FOREACH
  116. // http://mkb-wiki.herokuapp.com/wiki/iterators
  117.  
  118. // Logs name of each player to chat
  119. foreach(players,&current_player)
  120. log(%&current_player%)
  121. next;
  122.  
  123. // Arrays also work. Reference the array as "arrayname" with no additional symbols.
  124.  
  125. // Split string into array with delimiter ","
  126. &string = "p1,p2,p3,p4"
  127. &arrayname = split(",",%&string%)
  128.  
  129. // Log each iteration to chat
  130. foreach(arrayname,&current_iteration)
  131. log(%&current_iteration%)
  132. next;
  133.  
  134. Here's a list of all commands: http://mkb-wiki.herokuapp.com/wiki/commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement