Recipe creation syntax #5210
Replies: 3 comments 3 replies
-
While I don't believe it would be possible to make any syntax support all possible recipes we could most likely make 2-3 separate syntaxes under the same stuff I believe we should exclude register a new [:shapeless] crafting recipe for %itemstack% with key %string%:
shape: # I do like the idea of using shape for this the hacky method doesn't looks terrible register a new smelting recipe for %itemstack% with key %string%:
type: %cooking recipe% # not sure if we should add a type or hard code the accepted smelters in but this should include (furnace, blast, smoker, cooking recipe and campfire)
cooking time: %timespan%
experience: %integer/number%
input: %itemstack% register a new (:smithing|stonecutter) recipe for %itemstack% with key %string% not sure how their section entries should look as both are pretty different and do different things but are the only ones left |
Beta Was this translation helpful? Give feedback.
-
Buckle up everybody this is gonna be a long one :') TL;DR
I have concerns about this style of syntax, but they're greater concerns about how we're intending to use sections. So I initially raised reservations about this style of syntax with @APickledWalrus who had proposed this: Now there are advantages to the structure, it's probably fast to parse, but it has some drawbacks. ContractsSkript, as a programming language, is built on a set of 'contracts' (or rules, if you prefer.) An ideal language follows its contracts for consistency. Why contracts are importantContracts allow us to write reliable code. They allow us to trust our code. Do we have contracts in Skript?Yes. They're implicit.
Skript has always had a de facto contract that every line within a code trigger will be some kind of effect, whether that's a direct one ( How is this relevant?In your (and @APickledWalrus) suggestion-
-we are violating this contract. Is this contract important?It makes Skript simple to read. I can take (almost) any line of Skript code on its own and infer what it does and where it should go. Here are some examples:
We cannot make these determinations about unqualified expressions:
AlternativesFortunately, this isn't the end of the world. If you're willing, perhaps we can look for similar alternatives for recipes. ConclusionAt the end of the day, we can make this change. We can get rid of our initial contract, open up Skript to this new style for sections. It could make Skript objectively better down the road. But I don't want us to do this flippantly. |
Beta Was this translation helpful? Give feedback.
-
Opening this discussion to get suggestions/feedback on recipe syntax for #5204. The current syntax in that PR is like this:
I don't mind this syntax, but some others have expressed rational concerns. For example, it gets really ugly when you use long lines and is kinda implemented in a hacky way. Another possible syntax I've considered is similar to the first but puts the ingredients under a "shape" subsection. I think this is slightly better than the first as it makes the purpose of the recipe lines clearer.
Keep in mind that the syntax should support all the different types of recipes (BlastingRecipe, CampfireRecipe, CookingRecipe, FurnaceRecipe, MerchantRecipe, ShapedRecipe, ShapelessRecipe, SmithingRecipe, SmokingRecipe and StonecuttingRecipe)
Beta Was this translation helpful? Give feedback.
All reactions