Skip to content

Doesn't support a value following a key on a separate line #9

Description

@JoBoDo

This isn't urgent to fix, I only found this problem with one line of my VDF, so I just fixed that line for now.
However if the value for a key is on a separate line, the parser gets very confused.
I was running multiple parses and the data was getting entrenched further and further with each run. It wouldn't reset to a normal state until I restarted the node server.

The "Attributes" key is followed by the "MODIFIER_ATTRIBUTE_MULTIPLE" value on the next line. (this data still compiles/runs successfully inside of dota2

"DOTAAbilities"
{
    "item_apply_modifiers"
    {
        "Modifiers"
        {
            "ai_agro_from_healing_modifier"
            {
                "IsHidden"          "1"
                "Attributes"        
                "MODIFIER_ATTRIBUTE_MULTIPLE"
                "OnHealthGained"    //OnHealReceived triggered every time
                {
                    "RunScript"
                    {
                        "ScriptFile"    "Ai/ai_agro_listener.lua"
                        "Function"      "EnemyReceivedHeal"
                    }
                }
            }

        }
    }                           
}   

I was parsing my ability file, followed by my units file

var abilityData = vdf.parse(abilities_file);
var unitData = vdf.parse(units_file);

abilityData was the one that was causing the issue, but when i ran console.log on my units file, it added "DOTAAbilities" and "item_apply_modifiers". Each additional time I ran my parsing function, it added additional depth to the units file...

    "DOTAAbilities": {
        "item_apply_modifiers": {
            "DOTAAbilities": {
                "item_apply_modifiers": {
                    "DOTAAbilities": {
                        "item_apply_modifiers": {
                            "DOTAAbilities": {
                                "item_apply_modifiers": {
                                    "DOTAAbilities": {
                                        "item_apply_modifiers": {
                                            "DOTAUnits": {
                                                "npc_dota_creature_npc_acedia_king_acedia": {
                                                    "precache": {
                                                        "model": "models/heroes/wraith_king/wraith_king.vmdl"
                                                    },

hope this all makes sense, let me know if you need some more information

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions