User Tools

Site Tools


scripting:introduction

Introduction to World Scripting

The Universal allows world owners to control much of the game via script. Using the custom scripting language you can create new behaviours for items and scenes on your world. Although the scripting language is fairly simple, you will require some knowledge of programming to understand and make the most of the features on offer. This section of the manual covers most of the basics about writing scripts - to really find out what you can do with it, you'll just need to try it out.

Script Files

The primary 'script' a server runs is stored in a file called Data\Scripts\ServerScript.mit - this is a text file that can contain commands and scripted 'events'.

After making changes to your ServerScript.mit you will need to use the command.. <codedoc> *reloadscript </codedoc> .. (alternatively press F11 if you are the world owner) for the changes to take effect.

The Scripting Language

The language used for scripting is a custom one (because Mit finds it more fun to write new things :] ) - but writing it should be easy enough for anyone used to most other programming or scripting languages, such as PHP, C, LUA, Java etc. Check here for an introduction to the language, and a description of the general format and limitations, and for further in-depth specifications of the individual script commands, check the 'Scripting Language Reference'.

Event Scripting

'Events' are triggered on the server when certain things happen on your world. For example, a certain 'event' is triggered when someone builds a new building. In most circumstances, the server itself handles the normal processes involved in the event - i.e. When someone builds a new building, the server automatically handles the adding of the new building to the map etc - then the script is called so you can do extra custom things.

As an initial example - perhaps you want to have a special building that when built, awards your players with a special item. The simple script to do this might look something like..

Event( "NewBuilding", "3" ) 
{ 
  *say %PLAYER% built building 3 
  *grantitem %PLAYER% Special Item
} 

If you've already been playing around with owner features on your world, then the *commands might already be familiar - Just about anything you can do using the commands on the server you can do through the scripting system - which leads to lots of possible clever features done in script.

For a further description on scripted Events, see the Event Scripting Overview and for a full list of the *commands see the reference section.

scripting/introduction.txt · Last modified: 2020/01/28 17:50 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki