scripting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting [2020/01/29 03:15] – mit | scripting [2023/05/15 02:07] (current) – [Custom Events] mit | ||
---|---|---|---|
Line 14: | Line 14: | ||
===== Introduction to World Scripting ===== | ===== Introduction to World Scripting ===== | ||
- | The Universal' | + | The world server allows owners to make little old games without any coding knowledge at all.. set up some buildings, add some models and fiddle with some settings and you can create quite different environments using the basic game framework. |
+ | |||
+ | If you want to make something particularly unique you'll need to start delving into the scripting language, through which you can control | ||
===== Event Scripting ===== | ===== Event Scripting ===== | ||
- | ' | + | ' |
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.. | 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.. | ||
Line 24: | Line 26: | ||
Event( " | Event( " | ||
{ | { | ||
- | *say %PLAYER% built building 3 | + | *say %PLAYER% built building |
- | *grantitem %PLAYER% Special Item | + | *grantitem %PLAYER% |
} | } | ||
</ | </ | ||
- | 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. | + | 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 gives the script |
For details on the range of events supported see the [[scripting: | For details on the range of events supported see the [[scripting: | ||
===== Script Files ===== | ===== Script Files ===== | ||
- | The primary ' | + | The primary ' |
For a quick Hello World example.. Connect to your world, copy the code block below into your serverscript.mit, | For a quick Hello World example.. Connect to your world, copy the code block below into your serverscript.mit, | ||
Line 43: | Line 45: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Editing your script files ===== | ||
+ | If you get heavily into scripting, you may find that using an IDE such as Microsoft Visual Studio helps make managing your script files a bit easier. A quick guide to setting that up can be found [[scripting: | ||
+ | |||
+ | The intention is that eventually the Script Editor in the F10 World Editor screens would provide that functionality however that is a long way from being complete or usable. | ||
+ | |||
+ | ===== Custom Events ===== | ||
+ | Custom Events are a special type of event that is triggered from a command and can include custom parameters. | ||
+ | e.g. '' | ||
+ | |||
+ | will trigger an event specified in your script code like: | ||
+ | |||
+ | < | ||
+ | { | ||
+ | $text = $gTextParam[1] | ||
+ | *say Your Parameter was $text | ||
+ | }</ | ||
+ | |||
+ | Custom events can be triggered for groups of players - e.g. for everyone online (' | ||
+ | |||
scripting.1580289349.txt.gz · Last modified: 2020/01/29 03:15 by mit