Home   Help Search Login Register  

Author Topic: Retrieve ammo info from config  (Read 1243 times)

0 Members and 1 Guest are viewing this topic.

Offline Cheetah

  • Former Staff
  • ****
Retrieve ammo info from config
« on: 17 Nov 2007, 14:36:12 »
I'd like to be able to use:

configFile >> "CfgWeapons" >> weapon >> ammo

to retrieve the ammo for a specific weapon. I know where this info is,  don't know which class / name I have to use to retrieve the ammo for a 'weapon', because the config.bin is binarized. Could anyone point me to a tool to debinarize?
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Retrieve ammo info from config
« Reply #1 on: 17 Nov 2007, 16:14:21 »
Attached is the excellent prog PboView by...um...someone. MrFlea maybe  :D It allows you to open Pbos, view .pac files, open binarized configs etc etc...all without actually extracting the pbo (like cpbo does, for instance). You can also extract the files you want or need, or the whole pbo as well. It's great!  :good:

Wolfrug out.

PBOView OFPEC Resource
« Last Edit: 20 Aug 2009, 17:21:19 by hoz »
"When 900 years YOU reach, look as good you will not!"

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Retrieve ammo info from config
« Reply #2 on: 17 Nov 2007, 16:51:52 »
Is it the ammo you actually want or is it the magazine?

The ammo information is held in the cfgMagazines definition for the magazine.

The cfgWeapon definition for the weapon defines the magazine.

So you have:

Code: [Select]
cfgAmmo
    Definition of some ammo

cfgMagazines
    Definition of the magazine using above ammo

cfgWeapons
    Definition of weapon using the above magazine.


Planck
I know a little about a lot, and a lot about a little.

Offline Cheetah

  • Former Staff
  • ****
Re: Retrieve ammo info from config
« Reply #3 on: 18 Nov 2007, 14:54:36 »
Alright I managed to open the config with PBOview. I can't return the ammo used by a specific weapon with the code:

Code: [Select]
_ammo = configFile >> "CfgWeapons" >> _weapon >> "magazines[]";
hint format ["%1",_ammo];

What is wrong with this code?
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Retrieve ammo info from config
« Reply #4 on: 18 Nov 2007, 15:04:57 »
Whenever you delve into the config with >> you always end up with a "config entry", not the ArmA data type that it contains, thus you need to extract the array data from the config type:
Code: [Select]
_magazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
_description = getText (configFile >> "CfgWeapons" >> _weapon >> "displayName");
« Last Edit: 18 Nov 2007, 15:09:09 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)