Garry 的 mod Expression 2 for 循环

Posted

技术标签:

【中文标题】Garry 的 mod Expression 2 for 循环【英文标题】:Garry's mod Expression 2 for loop 【发布时间】:2016-01-17 16:45:48 【问题描述】:

在一个名为 Garry's mod 的游戏中,有一个名为 wiremod 的附加组件。在wiremod里面有表达式2,它是一个命令行基础的编码,所以执行命令。我遇到问题的命令 For 循环,因为我不能在变量中执行变量。在 CMD 中,我可以设置本地 EnableLocalExtension 并执行 !Var%Var%! 代码更简单的是:(capsensitive)

@inputs [GoCard1,GoCart2,GoCart3,GoCart4]:entity
X = 64
Y = 24

-N is the variable
-10 is max number
-1 is how much it increments by
for(N,10,1)

Menu:egpText(1,toString(GoCart1),vec2(X,Y)
Y+=24 -increase by 24
I++   -increase by 1

我的问题是我无法将 GoCart1 更改为 GoCart2、GoCart3... 等等 尝试了 GoCartN 但给了我一个错误 GoCartN 不存在 有人有什么想法吗?

【问题讨论】:

【参考方案1】:

简答我将代码分开

@inputs [GoCard1,GoCart2,GoCart3,GoCart4]:entity
X = 64
Y = 24
T = table(GoCart1,GoCart2,GoCart3,GoCart4)
for(N,10,1)

Menu:egpText(1,"1. "+toString(T[N,entity]),vec2(X,Y)
Y+=24 -increase by 24
I++   -increase by 1

如果有人知道如何将 GoCart 放入循环中,请告诉我

【讨论】:

以上是关于Garry 的 mod Expression 2 for 循环的主要内容,如果未能解决你的问题,请参考以下文章

Garry 的 mod lua,将矢量移近

经验心得Garry‘s mod:无尽的趣味与极致的体验

Garry的mod lua,尝试调用方法报错

LUA 将文件内容写入另一个(Garry's Mod)

停止 Lua 中的所有计时器(Garry's Mod)

资源分享Garry's mod 自制整合包