触发数组编号后更新全局变量

问题描述 投票:0回答:1

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

这是基本代码; enter image description here

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

例如,当玩家在屏幕上逐字逐句地绘制文本(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个回答
0
投票

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

if (message_current == myText[2])
{
    //change variable
}
© www.soinside.com 2019 - 2024. All rights reserved.