Command branch

SnowyOxygen
Would it be possible to make a sort of command branch maybe for a crafting system or a help system. For example:
craft maple bow
craft steel longsword
craft fire staff

^ These would of course make different weapons.

help combat
help currency
help quests

^ These would give documentation on areas you need help with.

If it is possible, could someone please show me how? Thanks!

jaynabonne
From a command point of view, you can create whatever commands you wish. For example, you can have a command with text "help combat" and handle that specifically. Or you can make a command with text "help #text#" and then branch based on the text to different help areas. It's up to you. The craft one is a bit specialized (that is, not applicable to all games), but the help command could be generalized for everyone to use.

HegemonKhan
for a help system, look into 'script dictionaries' (and 'string lists', and 'show menu' and~or 'get input')...

conceptually:

Command and Code Designs~methods (many various designs~methods that can be used):
What is your choice?
'show menu' or 'msg + get input' or just using the Command's 'text~object getting parameter ability'

String List: combat, magic, class, race, or etc

Script Dictionary: combat = script1; magic = script2; class = script3; race = script4

if (combat), then msg ("blah")
if (magic), then msg ("blah2")
etc...

so, for an example (using civilization^tm games), in pseodocode (too lazy to look up how to do proper format~syntax for script dictionary tag, and etc code lines):

<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</object>

<function name="help_function">
show menu ("Civilopedia", split ("techs;units;buildings;resources;wonders;governments;etc", ";"), false) {
invoke (ScriptDictionaryItem (global_data_object.civilopedia_script_dictionary, result))
}
</function>

<object name="global_data_object">
<attr name="civilopedia_script_dictionary" type="scriptdictionary">
<key item="techs">
<script>
show menu ("Techs", split ("wheel;mapmaking;nuclearfission;etc", ";"), false) {
invoke (ScriptDictionaryItem (global_data_object.civilopedia_script_dictionary, result))
</script>
</key>
<key item="units">
<script>
show menu ("Techs", split ("tank;axeman;phalanx;etc", ";"), false) {
invoke (ScriptDictionaryItem (global_data_object.civilopedia_script_dictionary, result))
</script>
<key item="wheel">
<script>
msg ("The wheel .... allowed for chariots, the plow, and etc....")
</script>
</key>
<key item="tank">
<script>
msg ("Tanks ended trench warfare, providing serious mobile land firepower...")
</script>
</key>
</attr>
</object>


------------------------

as for crafting, that's just 'basic' (though equipment coding isn't for noobs ~ use Chase's Wearables or Pixie's Clothing or Pertex' Combat Libraries) scripting, for a very simple example:

if (tin.parent = player and copper.parent = player) {
tin.parent = resource_data_object
copper.parent = resource_data_object
bronze_sword.parent = player
player.equip = bronze_sword
}

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums