Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Logic Operators in Reactions, Or Multiple Reference Tags (coded or moddable)  (Read 754 times)

Pickerel

  • Bay Watcher
    • View Profile

One of more of these would be great for organizing reactions, or having far fewer, making the actual referencing of a reaction more similar to the randomization in many hard-coded things.

1. Boolean Referencing:
One thing that could greatly reduce the number of reactions needing to be separately made when a general task is in order, is Boolean references.  It would actually implement similar to the Caste system.  For example, if there's ten things to be created, or 31 different ones as in glassworking, instead of multiple separate reactions, one could have one reaction, and variants.  I will quickly work up an example for glazes.  Currently, there are our reactions to glaze crafts, jugs, pots, and statues.  This is just copied and pasted from the raws:
Spoiler (click to show/hide)
However if you implemented the AND/OR function, it could be just one reaction:
Spoiler (click to show/hide)
What this is basically telling it is to use any glaze (due to the AND) and then to use one of the other options (statue, craft, ect.).  This would show up in the kiln as one reaction, and the person would have no control over what it used other than the usual control over placement nearer the kiln, of course, but the thing to point out is then it would be more like a lot of hardcoded things, like gem-decorating, and all sorts of other 'decorate with' tasks, as well as milling and dyeing: they choose an item of the proper material, but one normally has no control over what it is.  Sometimes, that's actually a good thing, because it cuts down on micromanaging, in this case of glazing.

2. Another way something similar could be done is with the ability to define one's own terms.  This would work similar to your definitions like ANY_RAW_MATERIAL.  For example, if I wanted to have one reaction that referred to all four of the above items, I could have, at the top of the raw, something like:
Spoiler (click to show/hide)
And then the reaction could be as short as...
Spoiler (click to show/hide)

3. Caste-like reactions: This could actually go well with another suggestion I had, which is a way to have categories and subcategories, like how at the loom you first choose your category (cloth type), and then your actual task.  Because I am more familiar with it, I will use glass items as an example, though. 
For glass:the 31 reactions could be shortened from such a list (pardon, taking this example from my own mod, hence it's not GLASS_GREEN or anything).  I will use only 4 of the 31 or so, just to illustrate without spamming.
Currently, to make glass do exactly what I want, I do it as such (though I also had to put it in a different building because we can't mod into the glass building, and it would clutter it up anyway):
Spoiler (click to show/hide)
But if reactions could be referenced in the raws like castes, this could be shortened to (and the specifics I am making up here...
Spoiler (click to show/hide)
I am sure you can see how much easier that is both to write (and such a lesser probability of errors) and to look at.  Imagine 31 reactions my way, vs the other way.
What the above shows would be the following: you go into the kiln (or in this case, my 'red glass shop'), and have the option to select 'red glass'.  This would then go to the next menu, where one selects the exact task they prefer.  Later entries precede higher hierarchy ones, but it is assumed that higher ones impose on lower ones (so all the traits of RED_GLASS are imposed on all sub-reactions, except, in this case, those like NAME and KEY, because new values are specified for each, thus replacing those otherwise imposed bu the higher order reaction.  This would still be a large number of entries, of course, that one would need to wade through when at the red glass shop in game, but that is how glass currently is anyway, and for a good reason.
Also, while at it, since this would mean subheadings, one could go further and make further layers.  For example, I could do the following:
Spoiler (click to show/hide)
How it would go here is one would choose 'red glass' at the red glass shop (tier 1), then one could either choose 'raw red glass' or 'furniture' (tier 2).  Furniture would bring one to further selections (tier 3), where I could choose from armor stands, boxes, and cabinets.  Now because these reactions now both have products and have no higher numbered tiers below them, they produce the product and no further menus are needed.

I hope this rant and idea come to some use.  Good night all!
« Last Edit: March 21, 2011, 07:56:25 pm by Pickerel »
Logged

Bohandas

  • Bay Watcher
  • Discordia Vobis Com Et Cum Spiritum
    • View Profile

But I like being able to choose what to glaze
Logged
NEW Petition to stop the anti-consumer, anti-worker, Trans-Pacific Partnership agreement
What is TPP
----------------------
Remember, no one can tell you who you are except an emotionally unattached outside observer making quantifiable measurements.
----------------------
Έπαινος Ερις

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile

OK, the title is a little confusing, since "boolean" means "either true or false", and this is a logic operation based upon boolean parameters. 

Actually, the rest of it was kind of confusing, too - you put lower-tier reactions on the same indent plane as using fuel and skill tokens in the higher-tier reactions.  It's kind of hard to see where the new reactions begin.  Of course, I'm viewing all this on pretty weary eyes, so trying to learn new scripting terms is just a bad idea to start with, so maybe it's on me, here.

I guess the best way to say this is, if this is what I think it is, and it is describing a way to make a (very dense read of a) script for making menus and sub-menus inside of player-defined workshop, then I'm all for this - anything that lends to better modding potential and better yet, organization of modding is always good by me.  I'd have to say, however, that this sort of script probably could use some line breaks and notation to be a little more user friendly, since it's somewhat ironic to try to make a more user-friendly interface in-game by creating a dense and modder-unfriendly raw.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Pickerel

  • Bay Watcher
    • View Profile

Ahh, you are quite right about my mistake in the title!  Apologies!  Fixing...
There.  I don't have time to clarify what I was trying to say, but I at least, I hope, made the title more accurate.

Also, some of the ideas I presented WOULD still allow one to select individual items to glaze, for example, or in general to select the item.  It just depends on the actual modification and the objective.
« Last Edit: March 21, 2011, 07:51:44 pm by Pickerel »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions

For #1, it would probably be feasible to drop the [AND] and [OR] entirely - if two reagents have the same name, then the game can pick an item that matches any of them.

For #3, your nested tag structure would probably be difficult to process (and to read) - a simpler option would be to define the reaction groups upfront as separate objects and then have each individual reaction reference them.

Code: [Select]
[REACTION_GROUP:MAKE_GREEN_GLASS]
   [NAME:green glass]
   [BUILDING:GLASS_FURNACE:CUSTOM_E]
   [REAGENT:sand:150:POWDER_MISC:NONE:NONE:NONE][SAND]
   [REAGENT:sandbag:1:BOX:NONE:NONE:NONE][CONTAINS:sand][BAG][PRESERVE_REAGENT]
   [FUEL]
   [SKILL:GLASSMAKER]

[REACTION:MAKE_RAW_GREEN_GLASS]
   [NAME:Make Raw green glass]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_G]
   [PRODUCT:100:1:ROUGH:NONE:GLASS_GREEN:NONE]

[REACTION:MAKE_GREEN_GLASS_ARMOR_STAND]
   [NAME:Construct green glass Armor Stand]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_A]
   [PRODUCT:100:1:ARMORSTAND:NONE:GLASS_GREEN:NONE]

Better yet, permit a reaction group to specify a product material, and permit one reaction to be part of multiple reaction groups:

Code: [Select]
[REACTION_GROUP:MAKE_GREEN_GLASS]
   [NAME:green glass]
   [BUILDING:GLASS_FURNACE:CUSTOM_E]
   [REAGENT:sand:150:POWDER_MISC:NONE:NONE:NONE][SAND]
   [REAGENT:sandbag:1:BOX:NONE:NONE:NONE][CONTAINS:sand][BAG][PRESERVE_REAGENT]
   [PRODUCT_MATERIAL:GLASS_GREEN:NONE]
   [FUEL]
   [SKILL:GLASSMAKER]

[REACTION_GROUP:MAKE_CLEAR_GLASS]
   [NAME:clear glass]
   [BUILDING:GLASS_FURNACE:CUSTOM_C]
   [REAGENT:sand:150:POWDER_MISC:NONE:NONE:NONE][SAND]
   [REAGENT:sandbag:1:BOX:NONE:NONE:NONE][CONTAINS:sand][BAG][PRESERVE_REAGENT]
   [REAGENT:pearlash:150:BAR:NONE:PEARLASH:NONE]
   [PRODUCT_MATERIAL:GLASS_CLEAR:NONE]
   [FUEL]
   [SKILL:GLASSMAKER]

[REACTION_GROUP:MAKE_CRYSTAL_GLASS]
   [NAME:crystal glass]
   [BUILDING:GLASS_FURNACE:CUSTOM_k]
   [REAGENT:crystal:1:ROUGH:NONE:NONE:NONE][CRYSTAL_GLASSABLE]
   [REAGENT:pearlash:150:BAR:NONE:PEARLASH:NONE]
   [PRODUCT_MATERIAL:GLASS_CRYSTAL:NONE]
   [FUEL]
   [SKILL:GLASSMAKER]

[REACTION:MAKE_RAW_GLASS]
   [PREFIX:Make Raw]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_G]
   [USE_REACTION_GROUP:MAKE_CLEAR_GLASS:CUSTOM_G]
   [USE_REACTION_GROUP:MAKE_CRYSTAL_GLASS:CUSTOM_G]
   [PRODUCT:100:1:ROUGH:NONE:GET_PRODUCT_MATERIAL]

[REACTION:MAKE_GLASS_ARMOR_STAND]
   [PREFIX:Construct]
   [SUFFIX:Armor Stand]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_A]
   [USE_REACTION_GROUP:MAKE_CLEAR_GLASS:CUSTOM_A]
   [USE_REACTION_GROUP:MAKE_CRYSTAL_GLASS:CUSTOM_A]
   [PRODUCT:100:1:ARMORSTAND:NONE:GET_PRODUCT_MATERIAL]

[REACTION:MAKE_GLASS_BOX]
   [PREFIX:Construct]
   [SUFFIX:Box]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_H]
   [USE_REACTION_GROUP:MAKE_CLEAR_GLASS:CUSTOM_H]
   [USE_REACTION_GROUP:MAKE_CRYSTAL_GLASS:CUSTOM_H]
   [PRODUCT:100:1:BOX:NONE:GET_PRODUCT_MATERIAL]

[REACTION:MAKE_GLASS_ANIMAL_TRAP]
   [PREFIX:Make]
   [SUFFIX:Animal Trap]
   [USE_REACTION_GROUP:MAKE_GREEN_GLASS:CUSTOM_P]
   [USE_REACTION_GROUP:MAKE_CLEAR_GLASS:CUSTOM_P]
   [USE_REACTION_GROUP:MAKE_CRYSTAL_GLASS:CUSTOM_P]
   [PRODUCT:100:1:ANIMALTRAP:NONE:GET_PRODUCT_MATERIAL]
   [SKILL:TRAPPING]
« Last Edit: March 25, 2011, 08:41:34 am by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile

While I think your methods are somewhat clunky, I do agree that more complicated tokens for reactions involving some good ol' fashioned boolean logic would be MUCHLY appreciated.  Toady wouldn't even have to put them into the game except for one brief example, maybe with honey or soap (since they're already in the raws almost 100%, and not hardcoded, we can see their structure better)
Logged
I like fortresses because they are still underground.

Aramco

  • Bay Watcher
    • View Profile

I, personally, would rather mod reactions the old fashioned way. So as long as you can do it either way, it seems like a good idea.
Logged
Or maybe there's a god who's just completely insane and sends you to Detroit, Michigan in a new body if you ever utter the name "Pat Sajak".

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile

Hmm... I think I like Quietust's version of organization better - it's easier to read when you can separate them out.

I think there might need to be a little more organizational tokens than what Quietust is indicating, however.  Sure, you can make anything with clear glass that you could make with green glass, but you might not necessarily want that to be the case.  For example, you might want to have the ability to make bricks from earthenware clay, but not porcelain bricks. Sure, you could make a separate reaction, but a more robust system allows us to make more complex reactions later on.  Having some sort of "include these" or "exclude these" token on either the reaction or the product half would work well.

I, again, like the notion of being able to better lasso slightly different types of materials into reactions by player choice (it would make something like masonry workshops where you can specify a magma-safe material for a floodgate possible, for example,) or generic "whatever's closest" categories easier. 

I remember someone making a mod with crossbow bolts that catch fire at room temperature, which had to be handled with nethercap gauntlets and quivers to keep them cold enough to not burn their wielders.  When we have real differentiation between material types, we need an ability to make differentiation in what materials we use, even though most woods are generally the same and can be used for the same things.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

sockless

  • Bay Watcher
    • View Profile

I think we should just wait for the RAWs arc.
The RAW system/language is horrible and it really needs a rewrite in my opinion. I'm pretty sure the reason for this is because it's really easy to read by a program.
Logged
Iv seen people who haven't had a redheaded person in their family for quite a while, and then out of nowhere two out of three of their children have red hair.
What color was the mailman's hair?

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile

According to Toady, the arcs beyond the army and caravan arcs are obsolete.  He's changing his way of plotting out the course of development.  Of course, the "Raw Arc" was more about creating procedural things than rewriting the raws themselves.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile

The only thing I do not like about the "raw language" is it's lack of "folder objects".  You can't designate a section of code with a beginning and ending and expect that the game will understand that everything between those points pertains to that object.  Rather, you just keep adding stuff, selecting where you're editing, etc, then declare you're on a totally new object.
Logged
I like fortresses because they are still underground.