Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Glass Block Reactions?  (Read 2035 times)

ahonek

  • Bay Watcher
  • Tekeli-li! Tekeli-li!
    • View Profile
Glass Block Reactions?
« on: March 25, 2011, 12:16:46 pm »

Hi there,

I'm relatively new to modding and the raws in general. I want to mod in a reaction, or change an existing reaction, to produce glass blocks (clear preferably, but it doesn't matter a whole lot). It's partially a learning experiment in modding and partially a way to supply myself with absurd amounts of glass blocks to make underwater domes and such.

I can't find glass block reactions in the raws anywhere, so I was wondering whether they even exist. grepping REACTION in my objects directory gets me all sorts of stuff, but none of them are block-related, and grepping neither GLASS nor BLOCK turns up anything useful.

What's going on here? Surely Tarn wouldn't hard code block reactions, when so many very similar reactions have made it out into the raws... would he?
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Glass Block Reactions?
« Reply #1 on: March 25, 2011, 12:18:25 pm »

There are none, by default, but not that hard to make.  Have it produce a block of glass, exactly as it sounds.  Something like [product:block:no_subtype:glass] or something.

ahonek

  • Bay Watcher
  • Tekeli-li! Tekeli-li!
    • View Profile
Re: Glass Block Reactions?
« Reply #2 on: March 25, 2011, 12:47:44 pm »

Oh, thanks! That'll do nicely.

I just replaced the pearlash reaction for now, into something like this:
Spoiler (click to show/hide)

It seems to be working fine, and my dwarves can convert 1 unit of wood into 1 clear glass block. Earlier when I was messing around though, I somehow caused the reaction to go super fast, and ended up with 110 bars of pearlash before I stopped the process. Do any of the above parameters have an impact on the speed of the job? At the time I had [REAGENT:A:1:BAR:NONE:WOOD:NONE] as my first attempt to define a log (which I know is incorrect) and my dwarves were using soap instead. Maybe that had something to do with it?
Logged

Pickerel

  • Bay Watcher
    • View Profile
Re: Glass Block Reactions?
« Reply #3 on: March 25, 2011, 02:32:25 pm »

It looks like you got it all working wonderfully, but I like to give a bit of extra info to new modders, little things I wished I knew as I was trying to flounder into it:
[PRODUCT:100:1:BLOCKS:NONE:GLASS_CLEAR:NONE]
Since you are new, I will go through exactly what this means, so you can work with it in the future.
100 = probability.  So you can have reactions that only sometimes produce stuff.  For example, galena smelting produces silver at something like a 50% ratio, I think.
1 = number.  If you want your reaction to produce LOTS, just up this number.  For example, if you want 500 clear glass blocks from one use, just change this to 500.
BLOCKS = tells it to make blocks.  If you use the dwarf fortress wiki, which is what I have taken a drastic liking to, the item that goes in this space is called the 'item token'.  For example, if I wanted to specify a 'basalt jug', this would be TOOL.
NONE = basically, whenever something says "NONE", it means 'not specified'.  So if there's multiple things with all the specified traits, it will take any of them as a reagent, but if one needs to specify in a product and doesn't, it gets wonky and one can get things like a generic 'stone' boulder with no properties, and such wierdness.  What would notmally go in this space is called the 'material definition token', which specifies a type.  For example, if I wanted to specify the above 'basalt jug', this would be ITEM_TOOL_JUG, telling it to look for that particular tool in the item_tool raw file.
GLASS_CLEAR = the games way of referring to the hard-coded 'clear glass'.  Things in this position are termed the 'material token', basically telling the game what type of material to use.  Again, there's a list on the DF wiki.  If, however, we wanted to specify the above mentioned 'basalt jug', this would be 'INORGANIC', because basalt, the mineral, is under the material heading of 'INORGANIC'.
NONE = because there's only one type of clear glass, and it isn't moddable, there's no need to specify a type of green glass, hence NONE.  This is essentially the type, in this position.  If, however, I were using the 'basalt jug' example, this would be BASALT, because it is where I specifically specify the material in question.
SO to reitterate, a reaction that produced, 80% of the time, two basalt jugs, would read:
[PRODUCT:80:2:TOOL:ITEM_TOOL_JUG:INORGANIC:BASALT]
which represent the following
[PRODUCT:probability:number produced:item token:specific item within that group:material token:specific material within that group]

For the log as you have it, [REAGENT:A:1:BAR:NONE:WOOD:NONE], won't quite work because logs are not the material, they are in fact the item, just as in your reaction 'bars' are the item.  So it should be [REAGENT:yay:1:WOOD:NONE:NONE:NONE] which basically says 'use ANY wood'.  Note: 'yay' is just a shorthand so that the reagent can be referred to later by that name, like if you wanted to refer to something in a bag, the bag could have the token [CONTAINS:yay], or if the bag itself was called 'biggles' you could tell the reaction to put the product in the bag at the end of the reaction by saying [PRODUCT_TO_CONTAINER:biggles].

The reason for the speed?  I donno... SKILL:SMELT I think is correct... and I think that's the only thing that affects it.  If the skill is incorrect or nonexistent, it will simply assume the time it takes is = 0, whereas otherwise the time is indeed based on the skill of the dwarf.

The reason for the wierd number of products is probably because some items are referred to oddly.  For example, one bar is in fact 150 units, so one often needs to put things like  [REAGENT:A:150:BAR:NONE:NONE:NONE] to get it to use 1 bar, or something like that.  But instead of use a fraction of the bar, it merely multiplies by the number of units in that bar, hence you probably got 150 bars of pearlash?  Am I wrong?  I too still struggle with when to use what amount of material for what items...

The reason for the wierd number of
« Last Edit: March 25, 2011, 02:48:43 pm by Pickerel »
Logged

ahonek

  • Bay Watcher
  • Tekeli-li! Tekeli-li!
    • View Profile
Re: Glass Block Reactions?
« Reply #4 on: March 25, 2011, 03:03:07 pm »

It might be the case that my earlier attempt was missing [SKILL:SMELT]. So maybe they were all happening instantly.
Logged

Upright Path

  • Bay Watcher
    • View Profile
Re: Glass Block Reactions?
« Reply #5 on: March 25, 2011, 07:17:43 pm »

The Skill token says what type of skill has to be enabled on the dorf to get them to do the job (And what job gets the EXP). In this case, if no Skill Token is listed, then any dorf can do it without an EXP gain.
Logged