by Zhs2 » Thu Mar 03, 2016 11:05 am
Alright. After thinking a little more on how to properly represent this problem without a huge project file, I have smithed together a crude example that reproduces this case.
This is the example in question. To reproduce: "pukename userarraytest" in console. In GZDoom 2.1.1 (ZDoom 2.8.1), this example *just works*, meaning it is able to correctly retrieve values stored to the array entries it scans through until it finds an empty position to store another value to, stores it, and stops there. In the latest version (topic title), it seems the value either never gets set or retrieved correctly (probably the former), and thus the script only attempts to store to position 0 of the player's user array.
Relevant code:
Code: Select all
#library "testcasegoboink"
#include "zcommon.acs"
script "UserArrayTest" (void)
{
int randomvalue = UniqueTID();
for(int i = 0; i < 999; i++)
{
if(GetUserArray(0, "User_TestArray", i))
{
continue;
}
else
{
SetUserArray(0, "User_TestArray", i, randomvalue);
HUDMessageBold(s:"I stored the value ", i:randomvalue, s:" to User_TestArray at position ", i:i;HUDMSG_FADEOUT|HUDMSG_LOG, 900, CR_GOLD, 0.5, 0.1, 3.0, 0.5);
break;
}
}
}
Alright. After thinking a little more on how to properly represent this problem without a huge project file, I have smithed together a crude example that reproduces this case. [url=http://tireiron.us/arraytest.pk3]This is the example in question.[/url] To reproduce: "pukename userarraytest" in console. In GZDoom 2.1.1 (ZDoom 2.8.1), this example *just works*, meaning it is able to correctly retrieve values stored to the array entries it scans through until it finds an empty position to store another value to, stores it, and stops there. In the latest version (topic title), it seems the value either never gets set or retrieved correctly (probably the former), and thus the script only attempts to store to position 0 of the player's user array.
Relevant code:
[code=php]#library "testcasegoboink"
#include "zcommon.acs"
script "UserArrayTest" (void)
{
int randomvalue = UniqueTID();
for(int i = 0; i < 999; i++)
{
if(GetUserArray(0, "User_TestArray", i))
{
continue;
}
else
{
SetUserArray(0, "User_TestArray", i, randomvalue);
HUDMessageBold(s:"I stored the value ", i:randomvalue, s:" to User_TestArray at position ", i:i;HUDMSG_FADEOUT|HUDMSG_LOG, 900, CR_GOLD, 0.5, 0.1, 3.0, 0.5);
break;
}
}
}[/code]