[JS][1.8.9][1.12.2]新手模板|避坑|排错|水影脚本编写中文教程|LiquidBounce Script
-
/// api_version=2 // 第一行三个斜杠的注释不要动,是脚本版本2的固定标识 // 下面是固定写法 var script = registerScript({ name: "MyScript", version: "1.0.0", authors: ["My Name"] }) // 玩家在游戏内发送消息 // mc.thePlayer.sendChatMessage() // 让文本显示在游戏聊天框里(不会发送聊天消息) // 支持原版颜色符号§,不支持& // Chat.print() script.registerModule( { name: "MyModule",//模块名称 category: "Misc", //分类 Movement, Misc, Combat, Fun, Player, Exploit, World, Render description: "An example module created with LiquidBounce's script API."//描述 }, function (module) { Chat.print("Module registered.")//模块已注册 module.on( "enable", function () { Chat.print("Module enabled.")//模块已启用 } ) module.on( "disable", function () { Chat.print("Module disabled.")//模块已禁用 } ) module.on( "update", function () { //Minecraft游戏每秒有20 tick //此function每一个tick就运行一次 //所以每秒执行20次 //不要在这里写for、while循环,否则Windows电脑的内存会立刻升高, //而且会把虚拟内存也占满,电脑马上就会蓝屏,写循环要去script.registerModule的外面写,也就是和script.registerModule并列。 } ) }) // 如果要定义变量名,直接写,前面好像只能加var // js代码会被编译成java字节码,所以如果是从网上复制的js代码,需要把let,const这些去掉 // 不然的话,游戏里不会出现你写的功能 // 如果js代码在浏览器上正常运行,不代表在这里能运行,多用Chat.print(),一步一测试
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login