This error message sometimes appears when trying to declare and initialize a local variable using type inference. For example:
Code: Select all
class Test
{
void TestFunc()
{
let p = players[consoleplayer];
}
}
Code: Select all
Script error, "zscript.txt:ZSCRIPT" line 5:
Cannot initialize non-scalar variable p here
On the other hand, this works fine:
Code: Select all
class Test
{
void TestFunc()
{
PlayerInfo p = players[consoleplayer];
}
}
It appears this happens when the declared type of the assigned value is prefixed with "@". For example, some global variables (in "struct _") are declared like this.
This error message sometimes appears when trying to declare and initialize a local variable using type inference. For example:
[code]class Test
{
void TestFunc()
{
let p = players[consoleplayer];
}
}[/code]
[code]Script error, "zscript.txt:ZSCRIPT" line 5:
Cannot initialize non-scalar variable p here[/code]
On the other hand, this works fine:
[code]class Test
{
void TestFunc()
{
PlayerInfo p = players[consoleplayer];
}
}[/code]
It appears this happens when the declared type of the assigned value is prefixed with "@". For example, some global variables (in "struct _") are declared like this.