aliens

Author Topic: Trying to create a new manufacture project.  (Read 6114 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Trying to create a new manufacture project.
« on: November 16, 2017, 09:00:21 am »
I've been trying to add a new manufacturing project via a custom Mod.

What I've done so far is create a directory called "./Test/" and place inside it a directory called "./Ruleset/".

In that directory I created two .rul files:
extraStrings_US_MR.rul    <---(Holds the new STR variables and their assigned values, in this case the name of the item to be manufactured.)
manufacture_MR.rul           <---(Holds the new manufacturing project.)


Contents of extraStrings_US_MR.rul:
Code: [Select]
extraStrings:
  - type: en-US
    strings:
  STR_TEST: "Test"

Contents of manufacture_MR.rul:
Code: [Select]
manufacture:
  - name: STR_TEST
    category: STR_HEAVY_WEAPONS_PLATFORM
    space: 25
    time: 1
    cost: 10
    listOrder: 50500
    producedItems:
      - STR_TANK_LASER_CANNON


When I toggled the Mod on in the OpenXcom options menu the following error was displayed:
Code: [Select]
Loading OpenXcom 1.0.132671d50 (2017-11-02 21:30) . . .

ERROR: failed to load 'test' mod disabled for next startup
/home/___/local/share/openxcom/mods/Test/Ruleset/extraStrings_US_MR.rul: error at line 4, column 4: end of sequence not found


Trying to debug my failure I've looked at the code in a few other user mods and as far as I can tell they're use of extraStrings: is basically identical in structure.

Could someone please point out the formatting mistake I'm making?

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #1 on: November 16, 2017, 09:20:26 am »
I changed extraStrings_US_MR.rul so that instead of 1 tab and 2 spaces it is now indented using only spaces and the error message is no longer being displayed.
(From what I've read the
YAML language which OpenXcom uses for *.rul files does not like tabs.)[/size]

However now I've encountered an additional problem.


When I load a game with the Test mod switched on and open the manufacturing menu the Test entry is there, but after selecting the project and clicking "Start Production" OpenXcom freezes.

In the openxcom.log file one of the last entries lists:

Code: [Select]
[16-11-2017_02-08-23] [FATAL] OpenXcom has crashed: Item STR_TEST not found
I though I'd defined the STR_TEST value inside the extraStrings_US_MR.rul file, do I need to also define it again elsewhere?

Offline Yataka Shimaoka

  • Colonel
  • ****
  • Posts: 284
  • I'm the trouble maker
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #2 on: November 16, 2017, 10:14:37 am »
Mind uploading your rulesets? It'll help us debug it too

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #3 on: November 16, 2017, 10:27:32 am »
Uploaded as requested.
« Last Edit: November 16, 2017, 10:51:44 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #4 on: November 16, 2017, 10:47:57 am »
After thinking about the error message found in the openxcom.log file, I just tried creating a third *.rul file called: items_MR.rul

This file has the following code in it:

Code: [Select]
items:
  - type: STR_TEST
    size: 0.0
    listOrder: 427500


When I combined this with the other two files the Mod no longer freezes when "Start Production" is clicked.

However instead of creating STR_TANK_LASER_CANNON (Which I'm assuming is a Laser Tank) it creates an item called "Test" instead.



I thought I was defining the manufacturing projects name with the extraStrings: not the item to be produced itself.


What I'm trying to do with this Test Mod is create a manufacturing project that builds 1 Laser Tank.

As there is already a manufacturing project to create Laser Tanks found in X-Com I'm trying to give the Test version of this manufacturing project a different name than just "Laser Tank" so they can be differentiated between easily.
« Last Edit: November 16, 2017, 10:50:36 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #5 on: November 16, 2017, 02:25:30 pm »
Perhaps I'm using the producedItems: variable incorrectly so it is defaulting to building the item referenced in the name: variable instead?

Is there away to assign an amount to the produced items listed in the producedItems: variable?

For example something like:
Code: [Select]
manufacture:
  - name: STR_TEST
    category: STR_HEAVY_WEAPONS_PLATFORM
    space: 25
    time: 1
    cost: 10
    producedItems:
      - STR_TANK_LASER_CANNON = 3
      - STR_TANK_PLASMA_CANNON = 2

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #6 on: November 16, 2017, 03:15:24 pm »
The syntax in your producedItems is wrong, so it defaults to making one of the item with the same type as the name of the manufacturing project. Try

Code: [Select]
manufacture:
  - name: STR_TEST
    ...
    producedItems:
      STR_TANK_LASER_CANNON: 1

The syntax issue is that using '-' before each line makes the YAML library read it as a list, when the code for loading manufacturing projects looks for a map of a number on to an item's type.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Trying to create a new manufacture project.
« Reply #7 on: November 16, 2017, 03:35:36 pm »
Thank you! ^_^

The manufacturing project functions as intended now.