【问题标题】:Update global variable after array number triggered触发数组编号后更新全局变量
【发布时间】:2019-04-28 06:33:51
【问题描述】:

我正在使用 Gamemaker Studio 2 和资产 FC's Dialogue System 作为我当前正在使用的代码的基础。

这是基本代码;

我现在要做的是,当到达数组中的某个消息时,会更改一个全局变量。

例如,当玩家在屏幕上看到 Text(2) 被逐字母绘制时,它会将全局变量 global.kaifound 更改为 20。

我尝试过使用 if 语句,例如:

if myText(2) { //change variable },

if myText = 2 { //change variable},

if message_current (Text(2)) { //change variable }等,

但是到目前为止我尝试过的所有方法都没有奏效。

有人知道我怎样才能让它工作吗?

干杯。

【问题讨论】:

    标签: game-maker game-maker-language game-maker-studio-2


    【解决方案1】:

    我不太确定您是如何使用数组或变量的。但我假设message_current 用于从数组中挑选一个字符串。在这种情况下,您应该使用[] 而不是()

    if (message_current == myText[2])
    {
        //change variable
    }
    

    【讨论】:

    • 不幸的是它没有用......还有其他想法吗? :)
    • 这很难用当前可用的源来判断,你能显示更多的代码吗?比如创建变量的位置?
    猜你喜欢
    • 1970-01-01
    • 2013-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-09
    • 1970-01-01
    相关资源
    最近更新 更多