Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 34 35 [36] 37 38 ... 42

Author Topic: [DFHack] Roses' Script Collection Updated 5/4/15  (Read 119930 times)

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #525 on: January 30, 2015, 05:29:40 am »

Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:steel:150:BAR:NONE:INORGANIC:STEEL]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][NOT_IMPROVED][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM_SKILL]
[IMPROVEMENT:100:target:COVERED:INORGANIC:STEEL]
[SKILL:FORGE_ARMOR]

Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][NOT_IMPROVED][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM_SKILL]

I tried these two. First one with reagent and improvement and armor smithing skill, the other one without reagent, improvement and skill.

Code: [Select]
[INORGANIC:IMPROVE_ITEM_SKILL]
  [USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
    [SPECIAL][NO_STONE_STOCKPILE]
    [MATERIAL_VALUE:0]
    [SYNDROME]
      [SYN_CLASS:this]
      [SYN_CLASS:upgrade-skill]

That's it. Maye Roses syntax changed between the version in old Masterwork and 40.x?

Roses, first post here has this list:
Quote
Intermediate (Raw/LUA_HOOK Based) Scripts Included: (these scripts currently lack documentation)
building-upgrade - handles changing building subtypes based on reactions
item-copy - copies any item of any material with a single reaction
item-imbue - changes the material of an item with a reaction
item-improve - change the quality of an already created item using a reaction
item-upgrade - change the subtype of an already created item
teleport - move unit(s) or item(s) from one place to another using reactions

Could you please write one working example of item-improve, item-upgrade and item-imbue?
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #526 on: January 30, 2015, 05:31:25 am »

... Reborn\Dwarf Fortress\hack\scripts/base_improveitem.lua:97
Those slashes don't look very healthy to me.

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #527 on: January 30, 2015, 10:46:14 am »

... Reborn\Dwarf Fortress\hack\scripts/base_improveitem.lua:97
Those slashes don't look very healthy to me.

Windows accepts forward slashes and backslashes as separators. It's fine.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #528 on: January 31, 2015, 07:50:52 pm »

Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:steel:150:BAR:NONE:INORGANIC:STEEL]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][NOT_IMPROVED][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM_SKILL]
[IMPROVEMENT:100:target:COVERED:INORGANIC:STEEL]
[SKILL:FORGE_ARMOR]

Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][NOT_IMPROVED][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM_SKILL]

I tried these two. First one with reagent and improvement and armor smithing skill, the other one without reagent, improvement and skill.

Code: [Select]
[INORGANIC:IMPROVE_ITEM_SKILL]
  [USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
    [SPECIAL][NO_STONE_STOCKPILE]
    [MATERIAL_VALUE:0]
    [SYNDROME]
      [SYN_CLASS:this]
      [SYN_CLASS:upgrade-skill]

That's it. Maye Roses syntax changed between the version in old Masterwork and 40.x?

Roses, first post here has this list:
Quote
Intermediate (Raw/LUA_HOOK Based) Scripts Included: (these scripts currently lack documentation)
building-upgrade - handles changing building subtypes based on reactions
item-copy - copies any item of any material with a single reaction
item-imbue - changes the material of an item with a reaction
item-improve - change the quality of an already created item using a reaction
item-upgrade - change the subtype of an already created item
teleport - move unit(s) or item(s) from one place to another using reactions

Could you please write one working example of item-improve, item-upgrade and item-imbue?

From the base/item-improve.lua
Code: [Select]
base_improveitem - used to improve item quality
Requires a reaction and an inorganic

REACTION OPTIONS:
All item reagents with [PRESERVE_REAGENT] will be flagged for improvement
Reagents without the [PRESERVE_REAGENT] tag will be consumed
The first product must be the inorganic with the syndrome attached to it
Subsequent products will be created as normal

EXAMPLE REACTION:
[REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_1] <- LUA_HOOK_UPGRADE_ITEM is required
[NAME:improve armor]
[BUILDING:IMPROVEMENT_SMITH:NONE]
[REAGENT:A:1:ARMOR:NONE:INORGANIC:NONE][PRESERVE_REAGENT]
[REAGENT:C:1500:COIN:NONE:INORGANIC:SILVER]
[PRODUCT:100:0:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]

INORGANIC OPTIONS:
Inorganics must have a syndrome with at least two [SYN_CLASS:] tags
Valid arguments for the first SYN_CLASS;
this - this will change the items in the reaction
all - this will change all items of the same type and subtype as the items in the reaction
ITEM_TOKEN - this will change a randomly selected item of the given token (e.g. ITEM_ARMOR_TEST_1)
Valid arguments for the second SYN_CLASS;
upgrade - this will upgrade the item to one higher quality
downgrade - this will downgrade the item to one lower quality
# - this will change the items quality to the given number
(OPTIONAL) A third SYN_CLASS can be added to specify duration of the change. Defaults to permanent. Duration is in in-game ticks

EXAMPLE INORGANIC:
[INORGANIC:UPGRADE_ITEM]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[SPECIAL]
[SYNDROME]
[SYN_CLASS:this]
[SYN_CLASS:upgrade]
[MATERIAL_VALUE:0]
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #529 on: February 01, 2015, 03:39:26 am »

Is it possible that this is slightly worng:

Quote
      [REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_1] <- LUA_HOOK_UPGRADE_ITEM is required

I've been going of your or Boltguns example the entire time, using

Code: [Select]
[REACTION:LUA_HOOK_[b]IMPROVE[/b]_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]
[SKILL:FORGE_ARMOR]

I'll try REACTION:LUA_HOOK_UPGRADE_ITEM_BREASTPLATE next.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #530 on: February 01, 2015, 03:42:32 am »

so uh

you gonna update this to use the scripts-as-libraries feature in 0.40.24-r2

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #531 on: February 01, 2015, 03:47:00 am »

Didnt work.

Putnam: I'm running r1 atm. And I dont know what you mean by this.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #532 on: February 01, 2015, 03:48:31 am »

Is it possible that this is slightly worng:

Quote
      [REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_1] <- LUA_HOOK_UPGRADE_ITEM is required

I've been going of your or Boltguns example the entire time, using

Code: [Select]
[REACTION:LUA_HOOK_[b]IMPROVE[/b]_ITEM_BREASTPLATE]
[NAME:Improve breastplate]
[BUILDING:STILL:CUSTOM_NONE]
[REAGENT:target:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][PRESERVE_REAGENT]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]
[SKILL:FORGE_ARMOR]

I'll try REACTION:LUA_HOOK_UPGRADE_ITEM_BREASTPLATE next.

It depends what you are trying to do. If you are trying to change the items quality then it is LUA_HOOK_IMPROVE_ITEM. If you are trying to change the subtype then it is LUA_HOOK_UPGRADE_ITEM. Remember that you need to initialize the scripts first (so put base/item-improve and base/item-upgrade in onLoad.init.

Didnt work.

Putnam: I'm running r1 atm. And I dont know what you mean by this.
Hes talking to me

so uh

you gonna update this to use the scripts-as-libraries feature in 0.40.24-r2
I should, I'm not sure all what I would have to do to update them though.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #533 on: February 01, 2015, 03:51:54 am »

Quote
(so put base/item-improve and base/item-upgrade in onLoad.init.

 :-\
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #534 on: February 01, 2015, 03:58:12 am »

Sorry if that was the problem. All of the base/ scripts need to be loaded before being usable. They used to be put in dfhack.init now the common thing to use is onLoad.init.

EDIT: Although expwnent said that he will be getting reagents and products available to reaction-trigger before too long, so these scripts (while still being usable) will become unneeded.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #535 on: February 01, 2015, 04:12:05 am »

Quote
(so put base/item-improve and base/item-upgrade in onLoad.init.

 :-\

It's literally just dfhack.init put into the raw folder.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #536 on: February 01, 2015, 05:17:39 am »

Yes, that was my mistake. I am so used to having everything enabled in Masterwork, I wasnt prepared for a fresh install of dfhack, with none of the custom scripts enabled.

Makes you feel really smart.

EDIT: HA! Now I got it to work. THERE MUST BE A SECOND REAGENT! That was the mistake.

This one works:
Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_BREASTPLATE] <- LUA_HOOK_UPGRADE_ITEM is required
[NAME:improve breastplate (boulder)]
[BUILDING:STILL:NONE]
[REAGENT:A:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][PRESERVE_REAGENT]
[REAGENT:C:1:BOULDER:NONE:INORGANIC:NONE]
[PRODUCT:100:0:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]


What made the difference is the boulder. It seems that the script requires you to use up some form of reagent to improve the item.
« Last Edit: February 01, 2015, 07:26:04 am by Meph »
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Boltgun

  • Bay Watcher
  • [UTTERANCES]
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #537 on: February 01, 2015, 08:53:46 am »

Yes, that was my mistake. I am so used to having everything enabled in Masterwork, I wasnt prepared for a fresh install of dfhack, with none of the custom scripts enabled.

Makes you feel really smart.

EDIT: HA! Now I got it to work. THERE MUST BE A SECOND REAGENT! That was the mistake.

This one works:
Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_BREASTPLATE] <- LUA_HOOK_UPGRADE_ITEM is required
[NAME:improve breastplate (boulder)]
[BUILDING:STILL:NONE]
[REAGENT:A:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][PRESERVE_REAGENT]
[REAGENT:C:1:BOULDER:NONE:INORGANIC:NONE]
[PRODUCT:100:0:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]


What made the difference is the boulder. It seems that the script requires you to use up some form of reagent to improve the item.

Oh wow, I was giving it a try, twisting the products. :P
I remember testing hook reactions without reagents so that's surprising.
« Last Edit: February 01, 2015, 08:56:09 am by Boltgun »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #538 on: February 01, 2015, 10:34:51 am »

Quote from: Roses
so uh

you gonna update this to use the scripts-as-libraries feature in 0.40.24-r2
I should, I'm not sure all what I would have to do to update them though.

Move your hack/lua files to raw/scripts/library and use dfhack.script_environment("library/blah").function(args) for basic usage. See LUA API.rst for details.
« Last Edit: February 01, 2015, 10:40:10 am by expwnent »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: [DFHack] Roses' Script Collection Updated 12/11/15
« Reply #539 on: February 01, 2015, 01:46:23 pm »

Yes, that was my mistake. I am so used to having everything enabled in Masterwork, I wasnt prepared for a fresh install of dfhack, with none of the custom scripts enabled.

Makes you feel really smart.

EDIT: HA! Now I got it to work. THERE MUST BE A SECOND REAGENT! That was the mistake.

This one works:
Code: [Select]
[REACTION:LUA_HOOK_IMPROVE_ITEM_EXAMPLE_BREASTPLATE] <- LUA_HOOK_UPGRADE_ITEM is required
[NAME:improve breastplate (boulder)]
[BUILDING:STILL:NONE]
[REAGENT:A:1:ARMOR:ITEM_ARMOR_BREASTPLATE:NONE:NONE][PRESERVE_REAGENT]
[REAGENT:C:1:BOULDER:NONE:INORGANIC:NONE]
[PRODUCT:100:0:BOULDER:NONE:INORGANIC:IMPROVE_ITEM]


What made the difference is the boulder. It seems that the script requires you to use up some form of reagent to improve the item.

Hmm, that's weird. I thought I made the second reagent fully optional. I guess I didn't.

Quote from: Roses
so uh

you gonna update this to use the scripts-as-libraries feature in 0.40.24-r2
I should, I'm not sure all what I would have to do to update them though.

Move your hack/lua files to raw/scripts/library and use dfhack.script_environment("library/blah").function(args) for basic usage. See LUA API.rst for details.

Seems simple enough. Can a library function use another library function?
Logged
Pages: 1 ... 34 35 [36] 37 38 ... 42