Edit 'Help' command
NecroDeath
27 Oct 2016, 14:15I need to add some extra information to the text that is returned when the player types 'help', is this possible? Thanks.
hegemonkhan
27 Oct 2016, 19:01you can over-write (though beware as you'll lose that built-in functionality for your game --- usually/generally it's a good idea to NOT over-write any of the built-in stuff --- I think the 'help' Command is safe to over-write: it's meant to be over-written by you) any built-in Verb/Command/Function/etc (Element) by creating/adding such Element ( http://docs.textadventures.co.uk/quest/elements/ ) with giving it the same name, for example, over-writing the built-in 'help' Command (in code, hopefully you can figure out how to add/create a new Command, which you give it the same name if you want to over-write a built-in Command, and set it up in/via the using GUI/Editor. If not, let me know and I'll help you with doing it in the GUI/Editor):
(or you can create/add in your own/custom uniquely named effectively 'help' or 'whatever' Command/Verb/Function/Etc, instead too, if you don't want to over-write any of the built-in Commands/Verbs/Functions/Etc, which is actually usually a good idea for most of the built-in stuff, as it's usually/generally good to not over-write the built-in stuff, so you don't lose its functionality, which may be vital/neccessary, or if not, then maybe later, you'd decide you want to use it within your game.
http://docs.textadventures.co.uk/quest/elements/command.html
<command name="help">
<pattern>help<pattern>
<script>
// content: put in what actions/events/scripting you want here/for-it
// for example:
msg ("Creating/Adding in this Command, will over-write the built-in 'help' Command, with displaying this message you're reading right now.")
</script>
</command>
// if you type in 'help'during game play, you'll see:
// Creating/Adding in this Command, will over-write the built-in 'help' Command, with displaying this message you're reading right now.
~~~ OR ~~~~
<command name="help">
<pattern>help;h;info;i<pattern>
<script>
// content: put in what actions/events/scripting you want here/for-it
// for example:
msg ("Creating/Adding in this Command, will over-write the built-in 'help' Command, with displaying this message you're reading right now.")
</script>
</command>
// if you type in 'help' or 'h' or 'info' or 'i' during game play, you'll see:
// Creating/Adding in this Command, will over-write the built-in 'help' Command, with displaying this message you're reading right now.
if you want to make a more specific (and totally separate-additional) 'help' Command:
<command name="help_input_command"> // or whatever you want to name it as, of course. The 'name' String Attribute is the 'ID' for quest, so you always want your 'names' to be unique (different), as it'll usually cause an error, unless it's specifically for over-writing some built-in Element
<pattern>help #text#;h #text#;info #text#;i #text#</pattern>
<script>
// you can use 'if' scripting, but for this example, I've chosen to use the 'switch' scripting instead:
switch (text) {
case ("strength") {
msg ("Strength is a primary character attribute: it's a requirement for wearing some equipment and it's used in calculations for damage with most types of weapons.")
}
case ("commands") {
msg ("The various commands you can enter are: help, help YOUR_INPUT/SUBJECT, warp (once you learned the 'warp' spell), buy, sell, char / c (see your "character screen"), equipment / e (see your equipment screen), item / (see your item screen), etc etc etc")
}
// etc 'cases' / help topics and their actions/scripting/messages
}
</script>
</command>
you'd type in during game play:
help strength
help commands
h strength
h commands
info strength
info commands
i strength
i commands
// ETC ETC ETC: help XXX / h XXX / info XXX / i XXX / case ("XXX")