Rain_Effect
本帖最后由 Rain_Effect 于 2018-6-11 17:57 编辑


本教程仍在编辑中!
目前更新至章节一:操作界面介绍及初步运用

编辑时帖子会进入审核状态,请稍等其恢复,不便之处敬请谅解

> MOD简介 <

      Macro/Keybind Mod的作用正如其名,是一个和宏与按键相关的mod。你可以通过这个模组,自定义键盘上按键的功能,如绑定指令运行脚本等。同时该模组也内置了自定义GUI的功能。如果合理使用的话,可以说不论搭配何种模组,都可以作为一个强力的辅助工具,即便是在服务器内。该模组从一些简单的操作,如一键回城玩家传送等简单的事情,到自动合成/种地,这个模组都可以替你完成。当你仅仅是想要自动化一件很简单的事情/编写一些简单的脚本,却找不到合适的工具的时候,那么,你可以试试这个模组。在试过之后,你会发现,动脑筋解决问题也是一件很有趣的事情。

> 我的话 <

      这个模组说真的,并不新奇,相反它其实在11年的时候就发布了,并在MCBBS中被很多用户搬运过很长的一段时间了,但是苦恼于配置的复杂/调整的繁琐,没有多少关于这个模组关键内容的更多教程,在这里我会给大家一一进行讲解和教学,各位可以期待一下,自己究竟通过这个模组,可以做到什么自己曾经做不到的?
站内搬运帖:
[1.12.X-1.3.2][Macro/Keybind Mod] 用来在游戏里写脚本的Mod--内含简单教程 - 搬运者: yhr
站外原帖:
MinecraftForum地址 LiteLoader PlanetMinecraft
历史帖子


> 请注意 <

本教程基于1.12.1版本下的Macro/Keybind Mod 0.15.4进行
各版本之间,部分参数会有不同的变动

如需将游戏内模组语言修改为中文,请看附录① Q&A提问区

本教程使用sm.ms图床


> 支持我 <

如果你支持我,以及我的教程,请给我评分点个人气,送个金粒!
要记得,评分是不会扣除自身人气的,但金粒会。
当然,有一定经济能力的,如果还能捐赠我喝杯咖啡,我会非常感谢的。



2021.12 数据,可能有更多内容


本教程仍在编辑中!
目前更新至章节一:操作界面介绍及初步运用
编辑时帖子会进入审核状态,请稍等其恢复,不便之处敬请谅解

&gt; MOD简介 &lt;

   Macro/Keybind Mod的作用正如其名,是一个和宏与按键相关的mod。你可以通过这个模组,自定义键盘上按键的功能,如绑定指令、运行脚本等。同时该模组也内置了自定义GUI的功能。如果合理使用的话,可以说不论搭配何种模组,都可以作为一个强力的辅助工具,即便是在服务器内。该模组从一些简单的操作,如一键回城、玩家传送等简单的事情,到自动合成/种地,这个模组都可以替你完成。当你仅仅是想要自动化一件很简单的事情/编写一些简单的脚本,却找不到合适的工具的时候,那么,你可以试试这个模组。在试过之后,你会发现,动脑筋解决问题也是一件很有趣的事情。

&gt; 我的话 &lt;

   这个模组说真的,并不新奇,相反它其实在11年的时候就发布了,并在MCBBS中被很多用户搬运过很长的一段时间了,但是苦恼于配置的复杂/调整的繁琐,没有多少关于这个模组关键内容的更多教程,在这里我会给大家一一进行讲解和教学,各位可以期待一下,自己究竟通过这个模组,可以做到什么自己曾经做不到的?
站内搬运帖:
[1.12.X-1.3.2][Macro/Keybind Mod] 用来在游戏里写脚本的Mod--内含简单教程 - 搬运者: yhr
站外原帖:
MinecraftForum地址 LiteLoader PlanetMinecraft
历史帖子搬运帖:
[1.3.2][SSP][必备][Macros] 快捷键绑定
搬运者: strawmaine
搬运于2012-08-18 - 最后更新于2012-09-11


[1.5.2~1.5.1][ssp/smp][汉化]宏/热键绑定(MACRO / KEYBIND MOD)[0.9.9]
搬运者: yuningning520
搬运于2013-03-29 - 最后更新于2013-05-05


[1.6.x/1.7.2][LiteLoader][smp]宏/热键绑定 MACRO / KEYBIND MOD
搬运者: sb023612
搬运于2014-02-11 - 最后更新于2014-02-18


[1.7.10]宏/热键绑定 Macro / Keybind
搬运者: antecer
搬运于2014-08-08 - 最后更新于2014-08-08


教程帖:
[1.7.10/1.8]宏/热键绑定—Macro/Keybind[交流讨论/教程]
撰写者: Miku_Snow(我敬爱的欠费千飞夏)
撰写于2015-11-20 - 最后更新于2015-11-23





&gt; 请注意 &lt;

本教程基于1.12.1版本下的Macro/Keybind Mod 0.15.4进行
各版本之间,部分参数会有不同的变动


如需将游戏内模组语言修改为中文,请看附录① Q&amp;A提问区


本教程使用sm.ms图床



&gt; 支持我 &lt;

如果你支持我,以及我的教程,请给我评分点个人气,送个金粒!
要记得,评分是不会扣除自身人气的,但金粒会。
当然,有一定经济能力的,如果还能捐赠我喝杯咖啡,我会非常感谢的。

好穷啊没人捐赠快饿死了




章节一操作界面介绍及初步运用
&gt; 操作/界面介绍 &lt;


   初次启动模组时,游戏会提醒你安装成功,并建议你打开&quot;控制&quot;去进一步了解该模组的操作按键。(如图一)

(图一)
   进入&quot;控制&quot;后,Macro模组的所有按键会默认置于最底(旧版本Macro为置顶),其中:
  • &quot;Macro activate&quot; 为激活键,默认为&quot;Grave&quot;(即&quot;Esc&quot;键下方第一个按键),用于打开宏激活菜单,可避免和控制内按键的冲突的情况下,启动当前按键下所设定的宏;
  • &quot;Macro console&quot; 为控制台,默认关闭(启用时默认为&quot;Grave&quot;键),可用于进行代码测试等操作,也是用户在制作这个脚本时经常使用到的一个功能;
  • &quot;Macro override&quot; 为防冲突按键,默认为冲刺键(即&quot;左Ctrl&quot;),可在被绑定宏的按键与其他按键冲突的时候,提前按住防冲键可在启动宏的情况下不会触发原按键的功能
    (例如G键我们绑定了合成表,而在该模组中我们对G键定义了发送&quot;/menu&quot;命令的宏,直接点击G键只能开启合成表,但如果在按G键之前,长按防冲键,会启用G键上的宏而不会打开合成表);
  • &quot;Settings key combo&quot; 为设置组合键,实际功能为宏定义菜单键,可使用该组合按键打开宏定义菜单,进行对按键/事件/界面等的宏定义。


   在游戏中,使用宏定义键,打开宏定义菜单,左上角为菜单按钮,紧接着中上方为宏定义界面切换,右上角为目前使用的配置方案,左下角为操作按钮,中下为操作提示栏,右下为多样化设置按钮,而在其中间的一大片则为各个宏定义方案的功能界面。而在宏定义菜单中,细分了宏定义三界面:&quot;按键Keys&quot;(图二&lt;1&gt;)、&quot;事件Events&quot;(图二&lt;2&gt;)、以及&quot;界面Buttons(翻译下为按钮)&quot;(图二&lt;3&gt;)

(图二&lt;1&gt;)

(图二&lt;2&gt;)

(图二&lt;3&gt;)


   使用控制台键(需启用后才能操作),可打开控制台菜单(图三),初次测试命令以及测试编写脚本均可在这里进行。

(图三)

帖子正在编辑中。。。



初步运用① 按键宏定义
&gt; 了解按键宏定义并进行初步运用 &lt;

   初

帖子正在编辑中。。。



附录① Q&amp;A提问区
Q1: 如何安装模组?
A: 模组需要LiteLoader的前置才能使用,可以于LiteLoader官网下载对应版本的安装器,并安装于拥有原版本核心的客户端内。当然你也可以使用HMCL进行直接下载,选择liteloader版本后,他会自动为你安装好所需的前置。
模组需要从官网下载,如果你无法翻墙的情况下可以到站内的搬运帖内进行下载:
[1.12.X-1.3.2][Macro/Keybind Mod] 用来在游戏里写脚本的Mod--内含简单教程 - 搬运者: yhr

Q2: 模组无自带中文该怎么办?
A: 模组本身无自带中文,的确是一个很恼人的痛,因为不是所有人都是英语十级,当然,其实也有解决办法的!这里我会附上一份汉化压缩包,使用压缩工具(例如winrar)打开macro的litemod文件,将相对应的汉化压缩包内的文件直接拖拽到模组内,在游戏内只要你的语言为“简体中文(中国)”就可以直接使用到模组的汉化内容。
支持1.7-1.10版本的汉化压缩包:
支持1.11-1.12版本的汉化压缩包:



如果有更多希望提问的问题,又或者在教程中发现什么错误,请在帖子内进行回复,我会统一回复的,谢谢。



附录② 参数列表



所有脚本列表
更新到1.12.1


脚本语法
返回数据
脚本简述
初次出现版本


游戏脚本
CLEARCRAFTING()
none
Clears the auto-crafting queue


CRAFT(&lt;item[:damage]&gt;,[amount],[throw],[verbose])
none
Queues an auto-crafting request


CRAFTANDWAIT(&lt;item[:id]&gt;,[amount],[throw],[verbose])
Queues an auto-crafting request and waits for it to complete


DISCONNECT()
Disconnects from the current game or server


GETID(&lt;x&gt;,&lt;y&gt;,&lt;z&gt;,&lt;#idvar&gt;,[#datavar])
ID of the block at the specified position
Gets the ID and optionally the data value of the block at the specified coordinates in the world


GETIDREL(&lt;xoffset&gt;,&lt;yoffset&gt;,&lt;zoffset&gt;,&lt;#idvar&gt;,[#datavar])
ID of the block at the specified position
Gets the ID and optionally the data value of the block at the specified coordinates relative to the player


GETITEMINFO(&lt;item[:damage]&gt;,[&lt;&amp;namevar&gt;],[#maxstacksize],[&amp;type],[#dropid])
Name of the item
Gets the name and other info for the specified item id, returns &quot;None&quot; if the item is not valid


GETSLOT(&lt;item[:damage]&gt;,&lt;#idvar&gt;,[startfromslotid])
Slot ID containing a matching item
Gets the id of the slot containing an item matching the specified item id, returns -1 if item not found


GETSLOTITEM(&lt;slotid&gt;,&lt;#idvar&gt;,[#stacksizevar],[#datavar])
Item ID of the item in the slot
Gets information about the item in the specified slot


INVENTORYDOWN([amount])
Scrolls the specified number of slots down through the hotbar


INVENTORYUP([amount])
Scrolls the specified number of slots up through the hotbar


ITEMID(&lt;item&gt;)
Legacy ID for the item
Gets the legacy (numeric) ID for the specified item


ITEMNAME(&lt;id&gt;)
Item descriptor for the specified item id
Get the item descriptor for a legacy (numeric) item ID


LOOK(&lt;yaw&gt;,[pitch],[time])
Faces the player in the specified direction, prefix angles with + or - for relative moves


LOOKS(&lt;yaw&gt;,[pitch],[time])
Smoothly turnes the player to the specified direction, prefix angles with + or - for relative moves


PICK(&lt;item[:damage]&gt;,[item[:damage]],...)
Item ID of the item which was picked or -1 if not picked
Selects the specified item id if it is on the hotbar, specify multiple items to pick in order of preference


PLACESIGN([line1],[line2],[line3],[line4],[showgui])
Places a sign in the world with the specified text (if you have one)


PLAYSOUND(&lt;sound&gt;)
Plays a sound


RESPAWN()
Respawns the player if you are dead


SETSLOTITEM([item[:damage]],[slot],[amount])
Creative mode only, set the contents of a hot bar slot


SLOT(&lt;slot&gt;)
Selects the specified slot on the hot bar


SLOTCLICK(&lt;slot&gt;,[button],[shift])
Simulates clicking on the specified slot in the current GUI, optionally using RMB and shiftkey


SPRINT()
Sets the player state to sprinting if sufficient stamina (food)


TILEID(&lt;item&gt;)
Legacy ID for the tile
Gets the legacy (numeric) ID for the specified tile


TILENAME(&lt;id&gt;)
Tile descriptor for the specified tile id
Get the descriptor for a legacy (numeric) tile ID


TRACE(&lt;distance&gt;,[entities])
Ray trace result type
Performs a ray trace operation which sets the raytrace variables in the local scope. Distance can be 3-256.


UNSPRINT()
Sets the player state to not sprinting


输入脚本
KEY(&lt;bind&gt;)
Activates the specified key binding for 1 tick


KEYDOWN(&lt;bind&gt;)
Sets the specified key binding state to pressed, only works with pressable bindings


KEYUP(&lt;bind&gt;)
Sets the specified key binding state to unpressed, only works with pressable bindings


TOGGLEKEY(&lt;bind&gt;)
Toggles the pressed state of the specified key binding, only works with pressable bindings


PRESS(&lt;lwjgl_name&gt;)
Injects the specified key event directly into the keyboard buffer for 1 tick


TYPE(&lt;text&gt;)
Injects the specified key sequence directly into the keyboard buffer at a rate of 1 key per tick


语言脚本
&lt;var&gt; = &lt;value&gt;
Internal function


BREAK
Interrupts exection of the innermost loop


CALCYAWTO(&lt;xpos&gt;,&lt;zpos&gt;,[#yaw],[#distance])
Yaw value to coordinates
Calculates the absolute yaw angle to the specified coordinates


DEC(&lt;#var&gt;,[amount])
Decrements the specified counter by 1 or by the specified amount


DECODE(&lt;input&gt;,[&amp;output])
Decoded string
base64_decode


DO([count])
Begins a loop, specify a number of loops to limit the loop count


ECHO(&lt;text&gt;)
Sends the specified message as a chat packet


ENCODE(&lt;input&gt;,[&amp;output])
Encoded string
base64_encode


ELSE
ELSE clause


ELSEIF(&lt;condition&gt;)
ELSEIF clause


ENDIF
ENDIF clause


ENDUNSAFE
Ends an active UNSAFE block


EXEC(&lt;file.txt&gt;,[taskname],[params],...)
Creates a task by running the specified script file


FOR(&lt;#var&gt;,&lt;start&gt;,&lt;end&gt;,[step])
Begins a FOR-&gt;NEXT loop using the specified var as a loop counter, #var can be used inside the loop


FOREACH(&lt;iterator&gt;)
Runs a loop over the specified iterator


GETPROPERTY(&lt;control&gt;,&lt;property&gt;)
Returns the value of the specified property from the specified GUI control


IF(&lt;condition&gt;)
IF clause


IFBEGINSWITH(&lt;haystack&gt;,&lt;needle&gt;)
IFBEGINSWITH clause


IFCONTAINS(&lt;haystack&gt;,&lt;needle&gt;)
IFCONTAINS clause


IFENDSWITH(&lt;haystack&gt;,&lt;needle&gt;)
IFENDSWITH clause


IFMATCHES(&lt;subject&gt;,&lt;pattern&gt;,[&amp;target],[group])
IFMATCHES clause


IIF(&lt;condition&gt;,&lt;truetext&gt;,[falsetext])
Inline IF statement, sends truetext as a chat message if condition succeeds, or sends falsetext if not


INC(&lt;#var&gt;,[amount])
Increments the specified counter by 1 or by the specified amount


ISRUNNING(&lt;macro&gt;)
True if the macro is running
Returns whether the specified macro is currently running


JOIN(&lt;glue&gt;,&lt;arrayname&gt;,[&amp;output])
Joined array parts
Implodes the specified array to a delimited string


LCASE(&lt;input&gt;,[&amp;output])
Input as lowercase
Converts the input string to lower case and stores it in output


LOG(&lt;text&gt;)
Outputs the specified text into the local chat stream


LOGRAW(&lt;json&gt;)
Similar to minecraft tellraw command, parses and outputs JSON chat into local chat stream


LOGTO(&lt;target&gt;,&lt;text&gt;)
Outputs the specified text into the specified target, target can be a text file name or the name of a textarea


LOOP
Ends a loop that was started with DO


MATCH(&lt;subject&gt;,&lt;pattern&gt;,[&amp;target],[group],[default])
The matched subpatterns
Runs a regular expression match on the subject and puts the result in &amp;target


NEXT
Completes a FOR-&gt;NEXT loop


PROMPT(&lt;&amp;target&gt;,&lt;paramstring&gt;,[prompt],[override],[default])
The supplied value
Displays a prompt (or prompts) by parsing the params in paramstring


RANDOM(&lt;#target&gt;,[max],[min])
Random value
Assigns a random number between min and max to target


REPLACE(&lt;&amp;subject&gt;,&lt;search&gt;,[replace])
Candidate with replaced values, does not alter source string if returned
Replace all occurrences of search with replace in &amp;subject


REGEXREPLACE(&lt;&amp;subject&gt;,&lt;search&gt;,[replace])
Candidate with replaced values, does not alter source string if returned
Replace all occurrences of search regex with replace in &amp;subject


SET(&lt;target&gt;,[value])
Sets the value of target to value (or TRUE if value is omitted)


SETLABEL(&lt;labelname&gt;,&lt;text&gt;,[binding])
Sets the text (and optionally binding) of the specified label


SETPROPERTY(&lt;control&gt;,&lt;property&gt;,&lt;value&gt;)
Sets the value of the specified property on the specified GUI control


SPLIT(&lt;delimiter&gt;,&lt;source&gt;,[output])
Array containing the split parts
Explode the supplied source string to an array


SQRT(&lt;value&gt;,[#outvar])
The square root as an integer
Calculate the square root of value and store it in #outvar


STOP([id])
Stops the current macro, or macros matching the specified ID


STRIP(&lt;&amp;target&gt;,&lt;text&gt;)
Stripped text
Strips all formatting codes from the specified text and assigns the result to &amp;target


TOGGLE([flag])
Toggles the specified boolean flag's value


UCASE(&lt;input&gt;,[&amp;output])
Input as uppercase
Converts the input string to upper case and stores it in output


UNSAFE(&lt;ticks&gt;)
Begins an UNSAFE block with execution limit set to ticks


UNSET(&lt;flag&gt;)
Un-sets the specified variable


UNTIL(&lt;condition&gt;)
Completes a loop started with DO but exits the loop if condition is met


WAIT(&lt;time&gt;)
Pauses the script for the time specified, suffix &quot;ms&quot; for a wait in milliseconds or &quot;t&quot; to wait in ticks


WHILE(&lt;condition&gt;)
Completes a loop started with DO but exits the loop if condition is not met


ARRAYSIZE(&lt;array&gt;,[&lt;outvar&gt;])
Size of the array
Stores the size of the specified array in outvar


INDEXOF(&lt;array&gt;,&lt;outvar&gt;,&lt;searchfor&gt;)
Index of searchfor
Gets the first index of searchfor in array and stores it in outvar, returns -1 on failure


POP(&lt;array&gt;,&lt;outvar&gt;)
Removes the last entry from the tail of array and stores it in outvar


PUSH(&lt;array&gt;,&lt;value&gt;)
Appends value to the end of array


PUT(&lt;array&gt;,&lt;value&gt;)
Inserts value at the first empty point in array


模组脚本
CONFIG(&lt;configname&gt;)
Switch to the specified configuration


IMPORT(&lt;configname&gt;)
Overlay the specified configuration


UNIMPORT()
Remove the specified configuration overlay if active


设置脚本
BIND(&lt;bind&gt;,&lt;keycode&gt;)
Set the specified key binding to the specified key code


CAMERA([mode])
Set the current camera mode, call with no arguments to toggle modes


CHATHEIGHT(&lt;value&gt;,[time])
Set height of the Minecraft chat whilst ingame 20-180


CHATHEIGHTFOCUSED(&lt;value&gt;,[time])
Set height of the Minecraft chat whilst in the chat GUI 20-180


CHATOPACITY(&lt;value&gt;,[time])
Set opacity of the Minecraft chat 0-100


CHATSCALE(&lt;value&gt;,[time])
Set scale of the Minecraft chat 0-100


CHATVISIBLE(&lt;value&gt;)
Set visibility of minecraft chat


CHATWIDTH(&lt;value&gt;,[time])
Set width of the Minecraft chat 40-320


FOG([value])
Toggles render distance, or optionally specify render distance


FOV(&lt;value&gt;,[time])
Sets the FOV angle in degrees, specifying time causes the value to change smoothly


GAMMA(&lt;value&gt;,[time])
Sets the brightness value (percent), specifying time causes the value to change smoothly


MUSIC(&lt;value&gt;,[time])
Sets the music volume, specifying time causes the value to change smoothly


RELOADRESOURCES
Reloads resource packs, same as pressing F3 + T


RESOURCEPACKS([pattern],[pattern...])
Sets the resource pack stack to the order matching the specified patterns


SENSITIVITY(&lt;value&gt;,[time])
Sets the mouse sensitivity (between 0 and 200), specifying time causes the value to change smoothly


SHADERGROUP([path])
Sets the active shader group to the shader matching path, use &quot;+&quot; to select next group


SETRES(&lt;width&gt;,&lt;height&gt;)
Sets the size of the minecraft game window


VOLUME(&lt;value&gt;,[time])
Sets the sound volume, specifying time causes the value to change smoothly


杂项脚本
ACHIEVEMENTGET(&lt;text&gt;,[itemid[:damage]])
Displays an &quot;advancement toast&quot; popup with a custom message


BINDGUI(&lt;slot&gt;,&lt;screen&gt;)
Binds the specified custom screen to the slot specified


CLEARCHAT()
Clears the current chat stream


GUI([name])
Show (or hide) a gui screen


POPUPMESSAGE(&lt;message&gt;,[animate])
Display a message in the action bar area


REPL
Access the REPL interface (experimental)


SHOWGUI(&lt;screen&gt;,[esc_screen])
Show a custom gui screen


STORE(&lt;type&gt;,[name])
Store a value into a list using the current environment


STOREOVER(&lt;type&gt;,[name])
Store a value into a list using the current environment and overwrite it if exists


TIME(&lt;[&amp;target&gt;],[format])
Time as a string
Stores the current time and date into &amp;target, optionally using format specified


TITLE([title],[subtitle],[inticks],[showticks],[outticks])
Displays the specified custom title, call with no arguments to hide current titles


TOAST(&lt;type&gt;,&lt;icon&gt;,&lt;text1&gt;,&lt;text2&gt;,[ticks])
Displays a custom &quot;toast&quot; popup


事件脚本
CHATFILTER(&lt;enabled&gt;)
Enable or disable the chat filter


FILTER
Indicate that this chat meesage should be filtered and terminate


MODIFY(&lt;newmessage&gt;)
Set new content for this chat message


PASS
Indicate that this chat meesage should PASS the filter and terminate




zjxx
讲真你可以用[index]目录代码来整理一下页码.jpg

Rain_Effect
本帖最后由 Rain_Effect 于 2018-6-2 13:52 编辑
zjxx 发表于 2018-6-2 13:11
讲真你可以用目录代码来整理一下页码.jpg

个人不太会使用[index]代码,所以有那么一丝,困惑。。。

--另外你头像的云豹,是认真的吗?

547802192
汉化包一直是损坏

Rain_Effect
547802192 发表于 2018-6-6 21:58
汉化包一直是损坏

是怎么损坏呢?我这边测试是全部可用的。

wansi
lz怎么关闭开单人/进服务器会弹出GUI啊

Rain_Effect
wansi 发表于 2018-8-13 21:22
lz怎么关闭开单人/进服务器会弹出GUI啊

这个我也不太清楚,目前也没有彻底的研究透彻

ZWLDD
这个mod可以后台使用吗,就是放在后台挂机,像自动钓鱼一样

Rain_Effect
这个得看你怎么去操作咯~按我可以明确说,可以的

大树先生
lz这个插件好像在绑定的时候不支持中文指令

thousand_shura
一直需要

Rain_Effect

后期会恢复更新,请期待一下。。。
虽然可能会有点晚