First things first, the script file:
You will find the master script file, "serverscript.mit" in the /data/scripts/ folder.
Secondly, loading the script file to your planet:
Pressing f11 will reload your script file.
There are several ways to cause a script to execute, called "triggers". Basically, when a pre-defined event set in the script file happens, the server executes a series of "*commands" (as if you, the world owner, were sitting there typing them in).
Event triggers include:
event( "&command", "command" ) - command a player would type following "&" in the world textbox to execute script
event( "newbuilding", "bdat building #" ) - executed when bldg # is built
event( "buildingdestroyed", "bdat building #" ) - when bldg # is destroyed
event( "buildingpurchase", "bdat building #" ) - executed when player purchases building #
event( "buildingtriggered", "bdat building #" ) - When bldg # is triggered... used with 'trigger' building type, executed after the trigger countdown sequence is completed.
event( "playerlogin", 0 ) - executed whenever a player lands
event( "playerdeath", 0 ) - executed when a player is killed.
event( "useitem", "Item Name" ) - executed when one of the 'usable item 1 - 32' items are used from players inventory. These items can be renamed to whatever, as long
as the item in the script file matches the new name.
***These are a basic event listing. There may be more added from time to time, as Mit finds necessary. Please Visit the Owners Manual Script Event Ref. Page for up to date listing. ***
The format of a script is important for proper function. the above examples are formatted how they would appear in the script file for proper execution, just stick your item name, command, or building number in and ur set to start your script.
along with event triggers, there are also player name references. they are as follows:
%player% - the player the script is executing for
%killer% - the player that killed %player%, used in "playerkilled" event
%buildingowner% - the owner of the building that executed the script.
the above are examples how they would need to appear in the script file. just substitute your building number or item name desired and your ready to go.
Code: Select all
event( "&command", "test" )
{
*say This is a test.
*grantitem %player% 100 wood
*grantcash %player% 500
}
event( "buildingdestroyed", "3" )
{
*say %player% has destroyed %buildingowner%'s building.
*grantkudos %player% 1
*grantkudos %buildingowner% -1
}
your whole script file execute at once on ya, or it could cause nothing to execute. Needless to say, it can get pretty messy.
This concludes the bare-bone basics scripts infopage. As more script basics become available, i will update this post. Soon i will post another with a little more complex scripting, keep a look out.
if anyone has any questions dont hesitate to hunt me down and ask, can usually find me in Ariya, or post here.