猫史档案馆


[不懂就问]求助gui.setattribute is not a function

用户:伴只狗头伴只狗头查看:8 回复:3 评论:8 创建时间:2023-08-05T21:30:51


rt 片段代码截取

setInterval(()=>{//ibxff此处为1秒更新 尽量在此替代ontick
    globalThis.tick+=1
    world.querySelectorAll('.biont').forEach((e)=>{
        e.velocity.y+=globalThis.biontJump
    })
    const $=async function(entity,name){
        return globalThis.getKey(globalThis.sourceMaterial, 
            await gui.getAttribute(entity,`#i${name}`,'src'))
    }
    
    world.querySelectorAll('player').forEach(async(e)=>{
        switch(e.ui){
            case '':break;
            case 'workbench':
                
                const info=[
                    [await $(e,'0x7'),await $(e,'0x6'),await $(e,'0x5')],
                    [await $(e,'1x7'),await $(e,'1x6'),await $(e,'1x5')],
                    [await $(e,'2x7'),await $(e,'2x6'),await $(e,'2x5')],
                ]
                console.log(globalThis.str(info))
                //todo
            break;
        }
    })
    
    
},1000)

 


回复

上一页1 页 / 共 1下一页
伴只狗头伴只狗头

ddd

点赞0


评论


yee剑走天下yee剑走天下

这代码里面没有gui.setattribute?

点赞0


评论


NomenNomen

检查上下文歧义,这是该bug最可能的因素

然后检查有没有拼错,最后在调用的时候log一下gui都有些啥

点赞0


评论