Here are the options available for modifying an extension, ordered from most to least preferred.
- Follow instructions in the extension's documentation
- Replace messages using the responses system
- Add, remove or replace rules
- Replace chapters
- Modify the extension directly
Try a solution lower on the list only if none of the ones above it don't work or don't apply. Modifying the extension directly should be the absolute last resort.
As an example let's look at a simple extension.
Version 1 of Greeter by Random Q Hacker begins here.
"Automatically greeting the player when the story begins."
Chapter 1 - Use Options
Use excessive enthusiasm translates as (- Constant GREETER_ENTHUSIASM; -).
Chapter 2 - Greeting
When play begins (this is the welcome the player rule):
say "Welcome! Have fun!" (A);
if the excessive enthusiasm option is active:
say "I'M SO PSYCHED!!!!!1!!" (B).
Greeter ends here.
---- DOCUMENTATION ----
Add "use excessive enthusiasm" to your source text
to get really enthusiastic greetings.
1. Follow instructions in the extension's documentation
Extensions ofter provide ways to modify their own behavior. Use these mechanisms whenever they’re available. In our example extension there’s a use option to change the mood of the default messages.
2. Replace messages using the responses system
From Inform release 6L02 on you can change default messages using the responses system (manual ch. 14.10.) This is the preferred way to modify what the extension prints out to the player, but it requires that the extension author has named the rules and strings so that they can be replaced.
In the example extension, if you wanted to replace the default messages you’d do:
The welcome the player rule response (A) is "Nice to see you!"
The welcome the player rule response (B) is "Super awesome!"
The >RESPONSES testing command can list all the default messages that can be changed in an extension (manual ch. 14.12.)
3. Add, remove or replace rules
If you need to modify something other than printed messages, you can replace or remove the extension’s rules (manual ch. 19.5.)
Removing rules completely:
The welcome the player rule does nothing.
Removing rules conditionally:
The welcome the player rule does nothing if the player’s name is "Bob".
Substituting rules:
This is the new welcome rule:
say "Hi there!"
The new welcome rule substitutes for the welcome the player rule.
If the rules are part of a rulebook you can add more rules to it (manual ch. 19.)
4. Replace chapters
For bigger changes you can replace chapters and sections altogether (manual ch. 27.9.):
Chapter 4 - New greeting (in place of Chapter 2 - Greeting in Greeter by Random Q Hacker)
This will effectively make the compiler ignore Chapter 2 in the original extension.
5. Modify the extension directly
If none of the above work, the last resort is to make a copy of the extension and modify it directly.
If you do this note that you must credit the original author of the extension, and it is preferred that you make a note that you have made modifications. Especially if you’re publishing the modified extension then crediting the author is not only basic manners but a requirement in the Creative Commons license that most extensions use.
The preferred way to provide credits in modified extensions is to add a third paragraph in the beginning of the extension, below the extension description, that is automatically printed when the extension is listed in the >VERSION info.
Version 2 of Greeter by Angela Author begins here.
"Automatically greeting the player when the story begins."
"based on the original extension by Random Q Hacker"