Author Topic: Issue with YAML in ruleset. "yaml-cpp: error at line 0, column 0: bad conversion  (Read 18392 times)

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Okay, Trying to get this very small ruleset to work and it's refusing to go.

Can anyone see what might be causing the issue?

I've tried shifting things around and nothing seems to fix it.


Offline VSx86

  • Sergeant
  • **
  • Posts: 29
    • View Profile
I'm just re-saved your file in UTF-8. Try it and report.

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
I'm just re-saved your file in UTF-8. Try it and report.

Same error.  Okay, Gonna take a few more things.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5420
  • punk not dead
    • View Profile
    • Nocturnal Productions
Must be some serious yaml error, use Falko's modtester or even an online yaml validator.

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Diox, thanks.
https://falkooxc2.pythonanywhere.com

--- posts merged ---

Huh, crammed it into Falko's tester and nothing.

This is just bizarre.  I'm gonna try to rebuild it again from scratch and see what happens.
« Last Edit: February 04, 2016, 09:05:02 am by Solarius Scorch »

Offline NoelBuddy

  • Colonel
  • ****
  • Posts: 142
    • View Profile
Huh, had the same error message working on an adding an advanced inc. grenade to the existing incendiary grenade mod from the mod site, I cut and pasted all of it into the existing incendiary grenade mod which had been working fine and it worked.  I didn't know what happened or how to recreate it for a helpful bug report so didn't post it.

Perhaps has to do with how many mods are being loaded at once?  or try patching it into a mod you already have loaded and see if that works?

Here's the resultant ruleset that worked. I don't have the version that didn't, but it was entirely cut and pasted into here and required no further alteration so every line that's different than the version posted by fatrat(https://www.openxcom.com/mod/incendiary-grenade). 
« Last Edit: October 02, 2014, 04:09:20 am by NoelBuddy »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
I had this message previously as well, but I don't remember how I got it (or got rid of it...). So I decided I'd investigate!

I chopped up your ruleset and tried to launch with only some parts of the mod, to identify when it would crash from yaml-cpp errors and when it would just complain that I am missing the resources.

Turns out it is your UFOPaedia entries that are crashing it. Specifically:
Code: [Select]
  - id: STR_HWP_CANNON_SHELLS
    section: STR_NOT_AVAILABLE
And
Code: [Select]
  - id: STR_HWP_ROCKETS
    section: STR_NOT_AVAILABLE

I checked inside XCom1Ruleset.rul and neither of these are defined in the ufopaedia section. You're defining a section for something that doesn't exist, instead of changing which section some existing entries would go in. I would have expected the program to just create those pages in the section you wanted, but it probably needs more info than just a section to create a page, so it crashes.

Since you just want to remove it any ways, removing the lines altogether should fix your mod. I tested it in 1.0, I hope it works in your build as well!

Offline NoelBuddy

  • Colonel
  • ****
  • Posts: 142
    • View Profile

... it probably needs more info than just a section to create a page, so it crashes.


 :o

type_id:

scratch that HWP ufopedias don't reference the ammo so there shouldn't be an entry for it at all.

« Last Edit: October 02, 2014, 04:47:36 am by NoelBuddy »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Haha, indeed, type_id is the only other needed.

There are already no ufopaedia entry for the ammos, which really is the main cause of this issue. If there had been an entry, the mod would just have changed its section. Instead, it tries to create a new page but is missing the type_id to do it and the whole thing crashes.

Why it returns line/column 0 as the problem is beyond me though.. that's really not helpful.

Offline NoelBuddy

  • Colonel
  • ****
  • Posts: 142
    • View Profile
Just tested, if you give it a type_id:4 it does solve the error.  It makes them an ammo entry that just sits there as there's no weapon to refer to it as a benign waste of code.

perhaps the error code has to do with the way YAML deals with defining -id: strings.  Not sure as OXcom is the extent of my YAML exposure so far.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
That makes sense then.

If you remove the lines, then you just remove the problem altogether and those pages don't get created, which is what KingMob wants, I think.

If you have the lines without the type_id, it's not able to create a new uropaedia page, so it crashes.

When you add the type_id, it creates an empty page. But.. which section did it put it in? STR_NOT_AVAILABLE is not much of a section...

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
type_id is a number 0-10 the number means one of these
            - UFOPAEDIA_TYPE_UNKNOWN
            - UFOPAEDIA_TYPE_CRAFT
            - UFOPAEDIA_TYPE_CRAFT_WEAPON
            - UFOPAEDIA_TYPE_VEHICLE
            - UFOPAEDIA_TYPE_ITEM
            - UFOPAEDIA_TYPE_ARMOR
            - UFOPAEDIA_TYPE_BASE_FACILITY
            - UFOPAEDIA_TYPE_TEXTIMAGE
            - UFOPAEDIA_TYPE_TEXT
            - UFOPAEDIA_TYPE_UFO
            - UFOPAEDIA_TYPE_TFTD
section can be one of these strings
            - STR_XCOM_CRAFT_ARMAMENT
            - STR_HEAVY_WEAPONS_PLATFORMS
            - STR_WEAPONS_AND_EQUIPMENT
            - STR_ALIEN_ARTIFACTS
            - STR_BASE_FACILITIES
            - STR_ALIEN_LIFE_FORMS
            - STR_ALIEN_RESEARCH_UC
            - STR_UFO_COMPONENTS
            - STR_UFOS
            - STR_NOT_AVAILABLE

the schema based modtester i work on would have found the error but its not in any way finished :(

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Not quite understanding the discussion about type_ids, but removing the ammo ufopedia entries helps, which allows me to test and try to get the two weapon tanks working.

Thanks for the help everyone!

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Well, the whole point is that the offending ufopaedia entries did not exist before you defined them, and defining them with just a category causes the yaml-cpp error you encountered.

The fix is indeed to just remove the entries, as long as you don't want those ufopaedia pages.

If you do want those pages, you need to define a type_id for them, along with the category, and optionally some text and an image.

Offline NoelBuddy

  • Colonel
  • ****
  • Posts: 142
    • View Profile
As a testament to my need to be more organized in my work spaces I found the original not working Inc_grenade_plus ruleset, and indeed there is a missing "type_id:" I must have noticed and fixed it during the transfer but not remembered doing that.