News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 21st Jun 2004, 09:58 PM   #1
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
odd log entry (original unreal engine)

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)
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Old 22nd Jun 2004, 08:19 AM   #2
aardvarkk
Registered User
 
Join Date: May. 7th, 2004
Posts: 64
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.
aardvarkk is offline   Reply With Quote
Old 22nd Jun 2004, 12:01 PM   #3
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
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)
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Old 22nd Jun 2004, 12:10 PM   #4
aardvarkk
Registered User
 
Join Date: May. 7th, 2004
Posts: 64
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.
aardvarkk is offline   Reply With Quote
Old 22nd Jun 2004, 03:07 PM   #5
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
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...
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Old 22nd Jun 2004, 03:37 PM   #6
Winged Unicorn
From wishes to eternity
 
Winged Unicorn's Avatar
 
Join Date: Jun. 23rd, 2003
Location: Italy, I think.
Posts: 108
That's a bug in the old engine. You cannot have an array inside a struct.
__________________
Ride to the starlight... there, where heroes lie
Winged Unicorn is offline   Reply With Quote
Old 22nd Jun 2004, 04:15 PM   #7
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
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?
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Old 23rd Jun 2004, 08:18 AM   #8
aardvarkk
Registered User
 
Join Date: May. 7th, 2004
Posts: 64
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!
aardvarkk is offline   Reply With Quote
Old 23rd Jun 2004, 02:05 PM   #9
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
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
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Old 24th Jun 2004, 05:00 AM   #10
Winged Unicorn
From wishes to eternity
 
Winged Unicorn's Avatar
 
Join Date: Jun. 23rd, 2003
Location: Italy, I think.
Posts: 108
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.
__________________
Ride to the starlight... there, where heroes lie

Last edited by Winged Unicorn; 24th Jun 2004 at 05:02 AM.
Winged Unicorn is offline   Reply With Quote
Old 24th Jun 2004, 10:11 AM   #11
theBane
Registered User
 
theBane's Avatar
 
Join Date: Apr. 5th, 2001
Location: BEHIND YOU!
Posts: 63
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.
__________________
A handsome young cyborg named Ace
Wooed women at every base,
. But once ladies glanced at
. His special enhancement
They vanished with nary a trace.
theBane is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer