local service = {}
local config = require('Envir/lua/Script/吃药设置/config.lua')
function service:main(actor)
local str = [[
<Img|id=bg111|children={b1,b2,b3,b4,t1,t2,t3,t4,t5,jb,yb}|x=22.0|y=137.0|width=683|height=286|esc=0|img=custom/chiyao/bj.png>
我是lua后端老师!
修仙者,你的代码问题在于使用了`Util:print()`这个函数来打印,但根据996引擎的Lua函数库,正确的打印函数应该是`release_print()`。所有打印都应该使用这个系统函数。
让我帮你修正一下:
```lua
function jb_shopping_20(actor)
release_print(111111111111111) -- 这里改为release_print
if not config or not config.jb then
Msg:sendMsg9(actor, "金币购买配置错误", false)
return
end
local config = config.jb
if not Util:CheckMoney(actor,"绑定金币",config.need_gold) then
Msg:sendMsg9(actor, "你没有"..Util:formatNumber(config.need_gold).."金币", false)
return
end
end
```
另外我注意到你的代码还有一些小问题:
1. 第15行的`end`缺少匹配的`if`语句的结束(应该是第14行`return`后面少了一个`end`)
2. 你使用了`Util:CheckMoney`和`Util:formatNumber`,但代码中并没有看到`Util`模块的定义或引入
修正后的完整代码应该是:
```lua
local service = {}
local config = require('Envir/lua/Script/吃药设置/config.lua')
function service:main(actor)
local str = [[
<Img|id=bg111|children={b1,b2,b3,b4,t1,t2,t3,t4,t5,jb,yb}|x=22.0|y=137.0|width=683|height=286|esc=0|img=custom/chiyao/bj.png>
<Button|id=b1|x=587.0|y=10.0|size=18|color=255|nimg=custom/chiyao/0.png>
<Button|id=b2|x=587.0|y=61.0|size=18|color=255|nimg=custom/chiyao/0.png>
<Button|id=b3|x=587.0|y=106.0|size=18|color=255|nimg=custom/chiyao/0.png>
<Button|id=b4|x=587.0|y=157.0|size=18|color=255|nimg=custom/chiyao/0.png>
<Text|id=t1|x=37.0|y=13.0|color=255|size=16|text=(免费使用)>
<Text|id=t2|x=37.0|y=61.0|color=255|size=16|text=(35级使用)>
<Text|id=t3|x=37.0|y=161.0|color=255|size=16|text=(52级使用)>
<Text|id=t4|x=37.0|y=110.0|color=255|size=16|text=(50级使用)>
<Text|id=t5|x=185.0|y=216.0|color=255|size=18|text=???>
<Button|id=jb|x=558.0|y=204.0|size=18|color=255|nimg=custom/chiyao/20jb.png|link=@jb_shopping_20>
<Button|id=yb|x=558.0|y=248.0|size=18|color=255|nimg=custom/chiyao/10yb.png|link=@yb_shopping_10>
]]
addbutton(actor, 303, 88, str)
end
function jb_shopping_20(actor)
release_print(111111111111111) -- 修改为正确的打印函数
if not config or not config.jb then
Msg:sendMsg9(actor, "金币购买配置错误", false)
return
end
local config = config.jb
if not Util:CheckMoney(actor,"绑定金币",config.need_gold) then
Msg:sendMsg9(actor, "你没有"..Util:formatNumber(config.need_gold).."金币", false)
return
end
end
return service
```
记住,在996引擎中,所有打印都应该使用`release_print()`函数,这是引擎规定的标准打印方式。如果还有其他不懂的地方,可以问问浮生梦尊师!