|
正文: 很多人刚接触 VV 引擎,会纠结一个问题:到底用 txt 脚本还是 Lua 脚本? 我的理解是:简单功能用 txt 可以,复杂系统尽量 Lua。 txt 的优点是上手快,适合简单 NPC: [color=color(srgb 0.101961 0.109804 0.121569 / 0.7)]
#ifcheckgold 1000#acttake 金币 1000give 回城卷 1
这种逻辑用 txt 很直接,没有必要硬改 Lua。 但一旦功能复杂,比如任务链、活动副本、拾取鉴定、随机词条、装备成长,txt 就容易变成: [color=color(srgb 0.101961 0.109804 0.121569 / 0.7)]
#CALLgoto#CALLgoto#CALL
最后脚本越来越绕,维护非常痛苦。 Lua 的优势是可以封装函数,把复杂逻辑整理成模块: [color=color(srgb 0.101961 0.109804 0.121569 / 0.7)]
if not ItemIdentify.CanIdentify(item) then returnendlocal quality = ItemIdentify.RollQuality(player, item)local attrs = ItemIdentify.RollAttrs(item, quality)ItemIdentify.Apply(item, attrs)ItemIdentify.Notify(player, item, quality, attrs)
这种写法逻辑清楚,后期扩展也方便。 我的建议: [color=color(srgb 0.101961 0.109804 0.121569 / 0.7)]
简单 NPC 对话:txt简单传送:txt 或 Lua 都行活动系统:Lua拾取鉴定:Lua装备词条:Lua副本系统:Lua全局事件:Lua奖励发放:Lua 封装
txt 不是不能用,但不要用 txt 硬堆大型系统。独家版本后期最怕的不是功能少,而是脚本结构乱。
|