--复制区域文件
--设置坐标起点,终点
--创建区域
--获取坐标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("生成成功")]]