用户:
凚离29查看:164 回复:3 评论:19 创建时间:2021-03-15T16:50:59
求助啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊
https://box3.codemao.cn/e/b1d4bd194ca9b480e74f
async_functionfor(let x=0;x<256;x++)for(let y=0;y<256;y++){
if(voxels.getVoxel(x,y,0)==voxels.id('air')){
voxels.setVoxel(x,y,0,'glass');/*第一道墙*/
}
if(voxels.getVoxel(0,y,x)==voxels.id('air')){
voxels.setVoxel(0,y,x,'glass');/*第二道墙*/
}
if(voxels.getVoxel(x,y,254)==voxels.id('air')){
voxels.setVoxel(x,y,254,'glass');/*第三道墙*/
}
if(voxels.getVoxel(254,y,x)==voxels.id('air')){
voxels.setVoxel(254,y,x,'glass');/*第四道墙*/
}
/*下面是封顶*/
if(voxels.getVoxel(x,63,y)==voxels.id('air')){
voxels.setVoxel(x,63,y,'glass');
}
await sleep(1);/*防止卡爆*/
}
/*这个是大地图的代码,输到控制台*/点赞0
评论
这是错的
光看我就知道有错误
await sleep()根本就是必须嵌套在(async()=>{})里的语句才能使用
a忽略了
而且少了两个{}
for(let x=0;x<256;x++)没发现没有{}括起来么
两个错误你这代码废了
那个不要紧
招人
https://box3.cod喵/e/52cc3d10ef270eb94627
不要紧?没有括号你整个代码都是废的
这可以使用好吧
招人啦https://box3.cod喵/e/52cc3d10ef270eb94627
js里如果下面只有一条语句花括号可以省略;但还是感谢你说出了await那个错误
兄嘚if只有一条语句的时候可以省略
好家伙我一般都是写括号,因为我js都是自己摸索着学的没具体学过我也不知道(雾)
async_function(async()=>{
for(let x=0;x<256;x++)for(let y=0;y<256;y++){
if(voxels.getVoxel(x,y,0)==voxels.id('air')){
voxels.setVoxel(x,y,0,'glass');/*第一道墙*/
}
if(voxels.getVoxel(0,y,x)==voxels.id('air')){
voxels.setVoxel(0,y,x,'glass');/*第二道墙*/
}
if(voxels.getVoxel(x,y,254)==voxels.id('air')){
voxels.setVoxel(x,y,254,'glass');/*第三道墙*/
}
if(voxels.getVoxel(254,y,x)==voxels.id('air')){
voxels.setVoxel(254,y,x,'glass');/*第四道墙*/
}
/*下面是封顶*/
if(voxels.getVoxel(x,62,y)==voxels.id('air')){
voxels.setVoxel(x,62,y,'glass');
}
await sleep(1);/*防止卡爆*/
}
})()
/*这个是大地图的代码,输到控制台*/
/*这个没错误*/点赞0
评论
nb
谢啦