User Tools

Site Tools


scripting:includes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
scripting:includes [2012/03/23 02:07] – created mitscripting:includes [2025/05/28 16:34] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ===== Includes ===== ===== Includes =====
  
-Rather than having all of your script code in the one 'ServerScript.mit' file, it is expected that you will split your script across multiple files, with each file usually relating to one area of your game-world. (e.g. You may have a file to handle all the usable items on your world). +Rather than having all of your script code in the one 'ServerScript.mit' file, it is expected that you will split your script across multiple files, with each file usually relating to one area of your game-world. (e.g. You may have a file to handle all the usable items on your world, or one for handling a particular cutscene or scripted building). 
  
 To link files into your script, use the format.. To link files into your script, use the format..
Line 9: Line 9:
 </codedoc> </codedoc>
  
 +e.g.
  
 +**ServerScript.mit**
 +<codedoc>
 +#include "CrowTournament.mit"
 +</codedoc>
 +
 +**CrowTournament.mit**
 +<codedoc>
 +Event( "Custom", "StartCrowTournamentUser" )
 +{
 +    *setcrow 1
 +    *crowlives 5
 +}
 +
 +Event( "Custom", "StartCrowTournament" )
 +{
 +    *say Crow Tournament commencing
 +    *eao StartCrowTournamentUser
 +}
 +</codedoc>
 +
 +Keeping related code separated like this can make it easier to share script across worlds - e.g. You could add your crow tournament feature to another world by copying the ''CrowTournament.mit'' file across and including it from the ServerScript.
  
scripting/includes.1332468444.txt.gz · Last modified: (external edit)