odd log entry (original unreal engine)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
for a gametype i made, i made an actor that records the location of summoned playerstarts and a description of the location in a .ini file, and made it work on multiple maps by having the location and description saved in an array, both in a struct array, like this:
Code:
struct PSList
{
var config vector PlayerStarts[20];
var config string Description[20];
};
var config PSlist Maplist[20];
(i remember reading on the wiki that this is the only way to do a multi-array). This was done to allow the locations to be saved to a total of 20 maps (hence the need for the struct) and 20 locations per map.
However, in my log file after trying it, i found a large number of the following error/warning:

Warning: ImportText: Illegal array element

I have no idea what this means, as I have never seen anything like it before, although im assuming it deals with the struct-in-array, leading me to assume that the best, maybe only, way to get rid of it is to get rid of the struct-array. However, I can't think of any other way to organize the list. Does anyone know what the error means, and how I can get rid of it (if i tried actually using it in the gametype, im assuming it would clutter the log file, as it seems to write several times whenever any of the functions that use the struct-array are accessed)
 

aardvarkk

New Member
May 7, 2004
64
0
0
have you tried outputting the elements of the array to make sure they stored properly? it appears to me like some sort of typecasting issue or something -- like it doesn't know how to convert from the data you're trying to input to the data the array is set up to handle.
 

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
ok, im for the most part a newb, so i dont know what you mean by outputting the array...
as for typecasting, there shouldn't be any. the vector array is being populated with vectors (mirroring the 'summon' command, i.e. the exec function sets it to about 72 units in front of the player), and description is being filled with strings, so there shouldn't be any typecasting at all (assuming i know what im talking about, that is)
 

aardvarkk

New Member
May 7, 2004
64
0
0
what i mean is that somewhere in your code, you should do some logging i.e.
log(Description) or whatever before you put it into the array.

you could also write a quick for loop to output the entire array each time you add an element. by output i mean log, so you can check the results.

if you debug it in this way, you can see if you're trying to put something illegal into the array and if so, what it is.
 

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
actually, all those vars are config, and they are being saved into a .ini file (properly too. except that because its an array in a struct, there are no returns between entries, making it a huge mess). I did however, add a log in the loop where the playerstarts are supposed to be spawned, which ins't working...
Code:
for (I=0; I<20; I++)
	{
	if (MapList[Mapnum].PlayerStarts[I] != vect(0,0,0) )
		{log("ADD START"); HSPlayerStarts[I]= Spawn(class'HSPlayerStart',,,MapList[Mapnum].PlayerStarts[I]); entries++;}
	else
		{log("BREAK"); break;}
	}
the log shows 20 of the "Warning: ImportText: Illegal array element" error, then "BREAK". No playerstarts are being spawned, and the ini is not filled with entries (it has about 3, and the loop should break as soon as it meets a blank entry). Im going to assume that the errors are why the entire damn thing doesn't work, but I still don't know why they are there...
 

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
dammit. is there some other way i can do something similar, other then making both of those have an array length of 400, and manually dividing it up for each map?
 

aardvarkk

New Member
May 7, 2004
64
0
0
i'm guessing this won't work, but have you tried using dynamic arrays?

i.e. array<int> MyDynamicArray;

then you can use MyDynamicArray.Length = 20, MyDynamicArray[1] = 15, etc.

i'm almost sure this won't work, but maybe dynamic arrays won't have the same problem as static ones within structs?

actually... maybe instead of making a struct you could make a whole new class? extend actor or whatever and call it NewMapInfo or something.

then just say:

var config NewMapInfo Maplist[20];

then within NewMapInfo you could have two vars that keep track of the description and player starts or whatever.

i don't know if that's possible, but try it out!
 

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
im not familar with a dynamic array, but im guessing that it wouldhave the same issue. as for creating a new actor class, i think i would need 20 new classes, to be able to have the twenty needed copies of each array, and have all of them be saved into a .ini, which sounds rather messy. I could try making 20 arrays for each, and get rid of the struct that way. it would probably be just as messy, but it wouldn't require new classes or spawning
 

Winged Unicorn

From wishes to eternity
You cannot use a dynamic array because they aren't supported in the old engine (at least, not from UnrealScript...). The only thing you can do is change the data type, by having something similar to this:

Code:
struct PSList_s
{
     var config vector PlayerStart;
     var config string Description;
};

var config PSList_s PSList[20];
var PSList Maplist[20];

Yes, it is pretty messy... but you have no other choices. Unless you want to make a linked list, but that can be even worse.
 
Last edited:

theBane

New Member
Apr 5, 2001
63
0
0
36
BEHIND YOU!
well, that won't work, because i needed the array in the struct, because i want to be able to save 20 starting places (as vectors) for 20 maps, in a .ini file, so what you just proposed wouldn't work. Also, for a single map, the .ini would be alot... 'cleaner', as i noticed that in a struct, there are no returns between the entries in the struct (so when i tried putting 40 vars in the one struct, it was a HORRIBLE mess). However, I'm currently working on just having 20 different arrays instead of the struct, and writing to/reading from them with functions. i think it will work.