Author Topic: Getting a list of objects from a terrain  (Read 974 times)

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« on: October 30, 2007, 05:48:43 AM »
Hello all,

I'm not editing a terrain, I'm writing a script that scores scenarios from the logs. I need to be able to match an object name (for example C02FUF0C5) to what and where that object is in the terrain.

Is there a way to get a complete list of objects with their names and locations? I've downloaded the TE and can't even manage to load up a terrain from the .res file. It seems to work but the terrain that comes up is blank.

Thanks for any help.

Trip

Offline NHawk

  • Silver Member
  • ****
  • Posts: 1787
Re: Getting a list of objects from a terrain
« Reply #1 on: October 30, 2007, 06:10:07 AM »
Quote
Originally posted by Trip01
Hello all,

I'm not editing a terrain, I'm writing a script that scores scenarios from the logs. I need to be able to match an object name (for example C02FUF0C5) to what and where that object is in the terrain.

Is there a way to get a complete list of objects with their names and locations? I've downloaded the TE and can't even manage to load up a terrain from the .res file. It seems to work but the terrain that comes up is blank.

Thanks for any help.

Trip
You can't load .res files into the TE. So, unless you have the source for the terrain you can't get exact locations of objects.
Most of the people you meet in life are like slinkies. Pretty much useless, but still bring a smile to your face when you push them down the stairs.
-------------------------------
Sometimes I think I have alzheimers. But then I forget about it and it's not a problem anymore.

Offline Denholm

  • Plutonium Member
  • *******
  • Posts: 9667
      • No. 603 Squadron
Getting a list of objects from a terrain
« Reply #2 on: October 30, 2007, 10:08:27 AM »
You would have to contact Skuzzy and get his permission to retrieve the original terrain files to write your program. If he allows you to he will send you the necessary files which you need to get the locations of objects on a particular terrain.
Get your Daily Dose of Flame!
FlameThink.com
No. 603 Squadron... Visit us on the web, if you dare.

Drug addicts are always disappointed after eating Pot Pies.

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« Reply #3 on: October 31, 2007, 07:14:04 AM »
Thanks. ASW designed the terrain and he has sent me the .oba file which contains the information I need except that it only seems to list objects like trains and barges - there is nothing in it relating to, for example, CIT, FUF, AAF and so on. Is there another file he can send me or some other way of him getting those objects listed?

Trip

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
Getting a list of objects from a terrain
« Reply #4 on: October 31, 2007, 07:59:23 AM »
The default object groups which should be available in the OE are made from *.til files just like the terrain tiles. You can one them in any text editor.


  BlauKreuz - Lentolaivue 34      


Offline MachNix

  • Nickel Member
  • ***
  • Posts: 644
Getting a list of objects from a terrain
« Reply #5 on: October 31, 2007, 11:14:04 AM »
Trip01,
Not sure I understand the question but the .oba should show more than just trains and barges.  For example the first line should list country 1’s headquarters.  If you open the .oba file in a text editor such as Notepad, the first line should start like this:
C01GMS000,       hq0, …
Where "CO1" means Country 1 is the owner, "GMS" means Group Master, "000" means first object, and "hq0" means the headquarters shape/group.
The next few lines should list Country 1’s cities and factories (city0, rdrfac0, aaafac0, fulfac0, amofac0, bacfac0), and then list all the country’s trains.  This pattern repeats for Country 2 and 3.  Finally the fields (lafld0, mafld0, safld0, port0, vfld0), towns (town0), entry points (entpnt), trucks and barges are listed.

The .oba is the correct file.  Perhaps the formatting of this file has changed from what you are used to seeing and things are now Group Master (GMS) instead of things like CIT and FUF.  You need to look at the second column to see what the GMS is referring to.

GL

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« Reply #6 on: October 31, 2007, 11:21:06 AM »
Quote
Originally posted by MachNix
Trip01,
Where "CO1" means Country 1 is the owner, "GMS" means Group Master, "000" means first object, and "hq0" means the headquarters shape/group.
The next few lines should list Country 1’s cities and factories (city0, rdrfac0, aaafac0, fulfac0, amofac0, bacfac0), and then list all the country’s trains.  This pattern repeats for Country 2 and 3.  Finally the fields (lafld0, mafld0, safld0, port0, vfld0), towns (town0), entry points (entpnt), trucks and barges are listed.

The .oba is the correct file.  Perhaps the formatting of this file has changed from what you are used to seeing and things are now Group Master (GMS) instead of things like CIT and FUF.  You need to look at the second column to see what the GMS is referring to.

GL


Yes, that's exactly what I'm seeing. The problem is that the event logs refer to individual buildings being destroyed, for example C02AMF0D6. I assume this building is part of a group listed as a GMS in the .oba file. How can I match the building name to a GMS?

Trip
« Last Edit: October 31, 2007, 11:55:28 AM by Trip01 »

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10899
Getting a list of objects from a terrain
« Reply #7 on: October 31, 2007, 11:57:04 AM »
Quote
Originally posted by Trip01
Yes, that's exactly what I'm seeing. The problem is that the event logs refer to individual buildings being destroyed, for example F01BAR01D. I assume this building is part of a group listed as a GMS in the .oba file. How can I match the building name to a GMS?

Trip
F01= field number 1, BAR= barge, 01D=the 29th copy of this type/shape (not likely for a barge number at field 1).

In game you can copy by hand all the items listed in destroy objects or, you can create a terrain in the TE with one object of every type, run an object report and save it to disk (.txt file). You'll have a complete list of the objects for each type of factory etc and it's less prone to error.

lol, you changed the item string.
« Last Edit: October 31, 2007, 12:06:29 PM by Easyscor »
Easy in-game again.
Since Tour 19 - 2001

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« Reply #8 on: October 31, 2007, 12:15:26 PM »
Quote
Originally posted by Easyscor

In game you can copy by hand all the items listed in destroy objects or, you can create a terrain in the TE with one object of every type, run an object report and save it to disk (.txt file). You'll have a complete list of the objects for each type of factory etc and it's less prone to error.

lol, you changed the item string.


I changed the item string because I realised I'd picked a barge out of the logs by mistake. Can you explain how I identify the zone for the AMF building I've listed? I know how to tell *what* it is, I need to know *where* it is.

This is particularly important for you Easy cos I'm working on a script for scoring DGS and your group have hit a lot of buildings I need to add points for ;)

Trip

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10899
Getting a list of objects from a terrain
« Reply #9 on: October 31, 2007, 12:43:26 PM »
Quote
Originally posted by Trip01
I changed the item string because I realised I'd picked a barge out of the logs by mistake. Can you explain how I identify the zone for the AMF building I've listed? I know how to tell *what* it is, I need to know *where* it is.

This is particularly important for you Easy cos I'm working on a script for scoring DGS and your group have hit a lot of buildings I need to add points for ;)

Trip
Muhaha! Sure, try to suck me in.:lol
The answer is that you can't without building your own data base of fields, countries and zones.
Easy in-game again.
Since Tour 19 - 2001

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« Reply #10 on: October 31, 2007, 01:36:08 PM »
Quote
Originally posted by Easyscor
The answer is that you can't without building your own data base of fields, countries and zones.


I've got no problem doing that but where do I get the data from?

Trip

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10899
Getting a list of objects from a terrain
« Reply #11 on: October 31, 2007, 01:36:13 PM »
btw, the oba file is useless to you.
The CMs change field ownership, zones and sometimes countries, in almost all the events.

Quote
I've got no problem doing that but where do I get the data from?


Again, even building a data base for fields would be pointless.
« Last Edit: October 31, 2007, 01:38:14 PM by Easyscor »
Easy in-game again.
Since Tour 19 - 2001

Offline ROC

  • Aces High CM Staff (Retired)
  • Platinum Member
  • ******
  • Posts: 7700
Getting a list of objects from a terrain
« Reply #12 on: October 31, 2007, 03:37:39 PM »
Quote
This is particularly important for you Easy cos I'm working on a script for scoring DGS and your group have hit a lot of buildings I need to add points for


Not quite sure what element you are scoring for DGS, but there may be variables that you are not aware of, nor will be.

The DGS score will be posted by the CM, and that's really the only score that will be relevant to the event as far as who won or lost.
ROC
Nothing clever here.  Please, move along.

Offline MachNix

  • Nickel Member
  • ***
  • Posts: 644
Getting a list of objects from a terrain
« Reply #13 on: October 31, 2007, 04:10:42 PM »
Quote
Originally posted by Trip01
Yes, that's exactly what I'm seeing. The problem is that the event logs refer to individual buildings being destroyed, for example C02AMF0D6. I assume this building is part of a group listed as a GMS in the .oba file. How can I match the building name to a GMS?

Trip

In the .oba file, the zone numbers are located in the next to the last column – column 18 if I counted correctly.  The zones are "zero indexed" meaning that Zone 1 will be listed as zero; Zone 2 will be listed as 1; etc.  But you may not need this information.

If all you get from the event logs is C02AMF0D6 then you will need to calculate which factory this object is in.  C02AMF0D6 means it is the 215th (D6 = 214 + 1 for zero index) Ammo Factory object for Country 2.  You can load the terrain in offline mode and go Options > Arena Setup > Objects > Destroy Objects to figure out how many objects and their types are in each factory.  For Ammo Factories, there are 88 (000 – 057 hex) AMF objects plus some guns.  Therefore the 215th AMF object would be in the 3rd [int(215/88) + 1 = 3] Ammo Factory for Country 2.  You would then look in the .oba file for third occurrence of "C02GMSxxx, amofac0" and this will be where the object is located.  You can then look in column 18 if you really need to know what zone it is in.

Offline Trip01

  • Copper Member
  • **
  • Posts: 118
Getting a list of objects from a terrain
« Reply #14 on: October 31, 2007, 04:38:29 PM »
Quote
Originally posted by MachNix

If all you get from the event logs is C02AMF0D6 then you will need to calculate which factory this object is in.  C02AMF0D6 means it is the 215th (D6 = 214 + 1 for zero index) Ammo Factory object for Country 2.  You can load the terrain in offline mode and go Options > Arena Setup > Objects > Destroy Objects to figure out how many objects and their types are in each factory.  For Ammo Factories, there are 88 (000 – 057 hex) AMF objects plus some guns.  Therefore the 215th AMF object would be in the 3rd [int(215/88) + 1 = 3] Ammo Factory for Country 2.  You would then look in the .oba file for third occurrence of "C02GMSxxx, amofac0" and this will be where the object is located.  You can then look in column 18 if you really need to know what zone it is in.


Brilliant MachNix that's exactly what I need. Many thanks.

Trip