Author Topic: Cross-MOD: Is Listorder needed?  (Read 5239 times)

Offline mercy

  • Colonel
  • ****
  • Posts: 341
    • View Profile
Cross-MOD: Is Listorder needed?
« on: October 30, 2013, 11:20:58 am »
I want to add Alloy Ammo clips to the SniperRifle (added to the game as a MOD weapon). 

SniperRifle_custom.rul is defined first in options.cfg and last is defined the Moriarty's Alloy_Ammo MOD. I need to add a Sniper-rifle-alloy clip section to the latter.

I insert the section
- type: STR_SNIPER_RIFLE   
into the alloy_ammo.rul with the whole weapon description. Then enter only the AA clips info, since the sniper rifle's normal clip is already defined in its original MOD.

But STR_SNIPER_RIFLE  is a modded weapon and in its original RUL it has a
   listOrder: 2202  for the item   - type: STR_SNIPER_RIFLE_CLIP
Do I need to insert a "listOrder: 2202" value into the alloy_ammo.rul as well, which MOD is defined after the  SniperRifle MOD in options.cfg?

BUT I noticed the main weapon having listOrder: 2201  the clip has   listOrder: 2202 so maybe for the whole game this listOrder: 2201 & listOrder: 2202 are "global variables" so if I define a new item for the sniper rifle in another MOD, I need to define a new variable AFTER the original ones and that would be listOrder: 2203 

How are these    listOrder: 2202 numbers are created anyway? Made up?
« Last Edit: October 30, 2013, 11:29:57 am by mercy »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Cross-MOD: Is Listorder needed?
« Reply #1 on: October 30, 2013, 11:29:01 am »
i'd make it 2203, listOrder is generated internally in increments of 100 for all items that appear in lists, starting from the top to the bottom.
rifle clip is the 22nd item listed in the ruleset, hence it's listorder is 2200. you want it to appear after this in the list, so you set it to a higher number, the higher the number, the lower on the list it goes. 2201 is the sniper rifle, 2202 is it's standard clip, 2203 is the next open slot between rifle clip and heavy cannon (2300)

this also has some future proofing built in, so if you have 2 or more mods that define an item using the same listorder, it will automatically assign the next available listorder slot according to ruleset load order. so if you defined your clip as 2200, but listed it after xcom1ruleset and sniperRifle, it would automagically get pushed down to 2203 anyway.
« Last Edit: October 30, 2013, 11:32:52 am by Warboy1982 »

Offline mercy

  • Colonel
  • ****
  • Posts: 341
    • View Profile
Re: Cross-MOD: Is Listorder needed?
« Reply #2 on: October 30, 2013, 11:31:12 am »
Thank You!!!

Now I can do  Sniper Rifle Alloy Ammo and Magnum Alloy Ammo. :D   

[Looking at imaginary aliens with evil grin]

Offline mercy

  • Colonel
  • ****
  • Posts: 341
    • View Profile
Re: Cross-MOD: Is Listorder needed?
« Reply #3 on: October 30, 2013, 12:59:14 pm »
YAML gave error on identation. I didn't put 2 spaces before "- type"  :D

It would be nice if the error message contained the file name as well:

"Error in Xxxx.rul     line 150 char 1  looking for identation"  or something.

Offline gix

  • Sergeant
  • **
  • Posts: 46
    • View Profile
Re: Cross-MOD: Is Listorder needed?
« Reply #4 on: November 10, 2013, 12:48:37 am »
i'd make it 2203, listOrder is generated internally in increments of 100 for all items that appear in lists, starting from the top to the bottom.
rifle clip is the 22nd item listed in the ruleset, hence it's listorder is 2200. you want it to appear after this in the list, so you set it to a higher number, the higher the number, the lower on the list it goes. 2201 is the sniper rifle, 2202 is it's standard clip, 2203 is the next open slot between rifle clip and heavy cannon (2300)

this also has some future proofing built in, so if you have 2 or more mods that define an item using the same listorder, it will automatically assign the next available listorder slot according to ruleset load order. so if you defined your clip as 2200, but listed it after xcom1ruleset and sniperRifle, it would automagically get pushed down to 2203 anyway.
Well, all listorder stuff was removed from all ufopaedia/modding/ruleset stuff. Therefore came the Bug report https://openxcom.org/bugs/openxcom/issues/282. I'd suggest since SupSuper is working on this to give him time to fix it and surely on ufopaedia will appear some ruleset guide once a definitive(?) solution will be  chosen...