当前位置: 首页 > news >正文

跨区域复制建筑UI输入框脚本迷你世界

7d59013d332a4b2e94e399bd173dce2c.jpg

0ead2f307d144dfd94d64e510a35e0df.jpg 

5c6a429cf0b24d389f7f96da34dafde3.jpg 

 

--复制区域文件
--设置坐标起点,终点
--创建区域
--获取坐标id,data
--星空露珠工作室制作
local pos1={x=-16,y=7,z=28}
local pos2={x=28,y=44,z=-9}
local block={num=0}
local str={}
local str0={}
local num=0
local count=0
local ui=6 --几个输入框  
local ro=math.random(33,65)
local io=[=[
 --别墅脚本
 --跨图复制脚本直接粘贴这里 
 --local strio={}
--核心解析脚本勿动,坐标可以修改
local x0,y0,z0=0,7,0 -- 生成坐标
local ro=str.ro
local function setBlock(x,y,z,id,data) print(x+x0,y+y0,z+z0,id,data) end --Block:setBlockAll(x+x0,y+y0,z+z0,id,data)
local function ay(id,te) setBlock(string.byte(te,1)-ro,string.byte(te,2)-ro,string.byte(te,3)-ro,id,string.byte(te,4)-ro) end
 for k,v in pairs(strio) do  print(k.."_长度"..string.len(v).."_块数"..string.len(v)/4)  while string.len(v)>2 and k~="ro" do local s0=string.sub(v,1,4) v=string.sub(v,5) ay(k,s0) threadpool:wait(time) end   end
print("生成成功")
]=]
--破坏方块
local function destoryBlock(x,y,z)  Block:destroyBlock(x,y,z,false) end
--放置方块
local function setBlock(x,y,z,id,data) Block:setBlockAll(x,y,z,id,data) end
--获取方块id并返回
local function getblockid(x,y,z) local result,id=Block:getBlockID(x,y,z)  return id end 
local function getblockdata(x,y,z) local result,data=Block:getBlockData(x,y,z) return data end
--创建一个区域
local result,areaid=Area:createAreaRectByRange(pos1,pos2)
--获取指定区域的起点和终点坐标,参数为区域id
local result,posBeg,posEnd=Area:getAreaRectRange(areaid)
print(posBeg)
print(posEnd)
local x,y,z=posBeg.x,posBeg.y,posBeg.z
str0={[1]="--跨图粘贴建筑\n--复制的文件  粘贴在下面 ( local str={}) \n local strio={"}
  for i=0,posEnd.y-posBeg.y do
    for j=0,posEnd.x-posBeg.x do
      for k=0,posEnd.z-posBeg.z do       
       if getblockid(x+j,y+i,z+k)~=0 and getblockid(x+j,y+i,z+k)~=4095 then           
        local id,data=getblockid(x+j,y+i,z+k), getblockdata(x+j,y+i,z+k) 
        local char=string.char(j+ro,i+ro,k+ro,data+ro)
          if block[id]~=true then block[id],block.num=true,block.num+1 print(id) 
          str[id]={[1]="["..id.."] =[=["..char}
          else 
          if string.len(str[id][#str[id]])+200>6000 then
          str[id][#str[id]+1]=char
         else
          str[id][#str[id]]=str[id][#str[id]]..char    
          end
         end
         count=count+1
       end        
      end 
     end
   end
print('获取完成共有方块:'..count.."\n共有几种:"..block.num)
Chat:sendSystemMsg("获取完成共有方块:"..tostring(count).."\n共有几种:"..tostring(block.num))
for k,v in pairs(str) do 
 for k0,v0 in pairs(v) do
  if string.len(str0[#str0])+string.len(v0)>10000 then     
   if k0==1 then str0[#str0]=str0[#str0].."]=],\n" 
      str0[#str0+1]=v0      
     if k0==#v then str0[#str0]=str0[#str0].."]=],\n" end
   else
     if k0==#v then str0[#str0+1]=v0.."]=]\n"  else str0[#str0+1]=v0 end
   end
  
  else 
   if k0==1 then str0[#str0]=str0[#str0].."]=],\n"..v0
     if k0==#v then str0[#str0]=str0[#str0].."]=],\n" end
   else
     if k0==#v then str0[#str0]=str0[#str0]..v0.."]=],\n"    else str0[#str0]=str0[#str0]..v0 end
   end
  end
 end
end
str0[#str0]=str0[#str0].."]=],ro="..ro.."}".."\n"..io
print("需要写入原件共需要:"..tostring(#str0).."个,每次点击按钮可写入"..tostring(ui).."个")
Chat:sendSystemMsg("需要写入原件共需要:"..tostring(#str0).."个,每次点击按钮可写入"..tostring(ui).."个")
for k,v in pairs(str0) do  print(string.len(v))  end
local num=0
local function o(e)
 if num==-1  then return end
 print("按钮点击:"..num+1)
 Chat:sendSystemMsg("当前写入第几页:"..tostring(num+1))
 for i=1,ui do
   if ui*num+i<=#str0 then local code = Customui:setText(e.eventobjid,e.CustomUI,e.CustomUI.."_"..i,str0[ui*num+i])     else  print("endend")  Chat:sendSystemMsg("完整获取,可重复循环")  num=0  return end          
 end
 num=num+1  
end
ScriptSupportEvent:registerEvent("UI.Button.Click",o)
--eventobjid,CustomUI,uielement
--UI.Button.Click

--[[
--跨图粘贴建筑
--复制的文件  粘贴在下面 ( local str={})

local str={}


--核心解析脚本勿动,坐标可以修改

local x,y,z=0,7,0 -- 生成坐标
local ro=str.ro
local function ay(id,te) setBlock(x+string.byte(te,1)-ro,y+string.byte(te,2)-ro,z+string.byte(te,3)-ro,id,string.byte(te,4)-ro) end
 for k,v in pairs(str) do   
    print(k.."_长度"..string.len(v).."_块数"..string.len(v)/4)
    while string.len(v)>2 and k~="ro" do local s0=string.sub(v,1,4) v=string.sub(v,5) ay(k,s0) end  
 end
print("生成成功")

]]
 

http://www.lryc.cn/news/308094.html

相关文章:

  • 取消退出流程控制方法
  • 力扣-跳跃游戏
  • 李沐动手学习深度学习——3.2练习
  • 代码随想录Day20 | Leetcode77 组合
  • Android Duplicate class 排除重复类
  • 【Kubernetes】服务(Service)是什么?有什么用?有哪些类型?
  • 【前端素材】推荐优质后台管理系统DAdmin平台模板(附源码)
  • Redis高级特性详解:事务处理、发布订阅、持久化和集群
  • nwjs做自动化测试
  • 【前端素材】推荐优质在线特殊品牌商城电商网页eStore平台模板(附源码)
  • Redis之一: 简介及环境安装搭建
  • 关于电脑一天24小时多少度电电脑的一天用电量计算
  • Unity3D 物理引擎的基本配置详解
  • CSS:弹性盒子Flexible Box布局
  • java常用环境docker安装
  • Code-Audit(代码审计)习题记录6-7
  • go 的使用总结
  • 无线水电表智能化管理系统
  • 发掘效率黑科技:Allure报告助您事半功倍提升测试效能!
  • Spring Web 过滤器使用常见错误(上)
  • 【数据结构】周末作业
  • java 企业培训管理系统Myeclipse开发mysql数据库web结构jsp编程计算机网页项目
  • 在SAP HANA中使用OData(二)
  • 【Docker】前端基于dockerfiel构建镜像部署,实现在容器启动时传递环境变量, 请求不同服务地址
  • 评估测试接口软件与网站的使用方法及优劣势比较
  • 【Qt学习】QLineEdit 控件 属性与实例(登录界面,验证密码,正则表达式)
  • Spring Boot 和 Spring Cloud: 区别与联系
  • 9.网络游戏逆向分析与漏洞攻防-游戏网络架构逆向分析-接管游戏连接服务器的操作
  • vue - - - - - vue3使用draggable拖拽组件
  • PHP语言常见面试题:请解释一下PHP是什么,以及它的主要用途是什么?