I just learned about Inform 7 and started writing a piece about a month ago. As I started writing, the rules became more and more complicated, and I realized I was writing an extension as much as fiction.
I am calling it YACS (Yet Another Combat System) and I would like some feedback on it. Have I just reinvented the wheel, or am I writing something useful here? It is written to support a fantasy genre, but could be altered to meet the needs of other genres, perhaps…
Any feedback is appreciated…
(I removed the code and will put it back when I rewrite it)
Welcome to the forum and thanks for the extension!
As a heads-up, I changed your quote tags to code tags–code tags preserve the tab stops, which lets people copy your code into their own IDE. You can also attach Inform extension files directly to your post. Unfortunately, it seems like you have spaces instead of tabs, so when I copied the code to my IDE it wouldn’t compile. If you don’t want to attach the extension, it’s best to copy-paste code directly from your own IDE.
A couple of other things I noticed:
One is you have a lot of stuff hard-coded that other authors might want to change. So an author might want to use 3d5 instead of 2d6, or change the thresholds, or something. If you want to make it an extension for other authors (as opposed to something for your own use) you might want to include a way of changing that–kind of like Graham Nelson did in The Reliques of Tolti-Aph. Similarly with the approach distance of 20.
Along similar lines, have a look at the “Responses” section of the documentation (§14.10); if you name rules and label the texts in the rules, authors will be able to modify the responses easily.
As a small point, instead of “the [second noun]” you should probably have “[the second noun]”–if the player is fighting Smaug, this will print “Smaug” instead of “the Smaug.”
Hmm. I copied and pasted from my extension. I wonder why the tabs didn’t come along.
Graham’s dice code is brilliant; I am still trying to wrap my head around it.
I am also reading the response code section. Is the response named by the rule? For example, if I write:
Can I later write:
The retreating from non-monsters is for show response (A) is "You step away from [the noun]".
and use the text of that as a response?
It looks like the process of changing the quote tags to code tags turned the tabs into spaces. That’s annoying! But you can edit your original message and paste the code from the IDE in place of the code we’ve got there, and I think it should work.
You’ve got the response thing right–you give the rule a name, and put a letter in parentheses next to the text, and then code can refer to the response by the name of the rule and its response. (You might have to change “it” to “something” to get the rule to work there, though–I’m not quite sure.) Also you have to include the word “rule” when you refer back to the rule:
The retreating from non-monsters is for show rule response (A) is "You step away from [the noun]".