GettingStarted: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 19: Line 19:


Check the [[ServerManual|Server Manual]] page.
Check the [[ServerManual|Server Manual]] page.
== Creating a New Resource ==
==== Add your resource to server.xml ====
Open file "server.xml" in a text editor, such as Notepad or Notepad++. The file is found in your root server directory.<br>
Scroll down to the "<resources>" tag, which is currently at the bottom of the xml file.<br>
Add a "<resource>" tag inside the "<resources>" tag, and give it an attribute with the name "src" and a value of the name of your new resource.<br>
For example:
{{CodeSyntax|1=<resources>
<!-- you will need to put the resources in the folder before any work -->
<resource src="freeroam" />
<resource src="my_new_resource" />
</resources>}}
==== Create folder for your resource ====
Open the "resources" folder, which is found in your root server directory.<br>
Create a new folder called "my_new_resource".
==== Create meta.xml for your resource ====
Create a file called "meta.xml" inside your "my_new_resource" folder.<br>
Add the following XML text to your meta.xml file:<br>
{{CodeSyntax|1=<meta>
<info author="your_username_here" description="Description for your new resource here." />
<script src="my_server_script.js" type="server" language="javascript" />
<script src="my_client_script.js" type="client" language="javascript" />
</meta>}}
==== Edit meta.xml for your resource ====
Fill in the defaults for the <info> tag, which include the author and description attributes.<br>
A resource doesn't need to have both server and client scripts, however this example includes both.<br><br>
A <script> tag is needed for each script (file) in your resource.<br>
The src attribute for the <script> tag, is the filename of a script, which will be inside your "my_new_resource" folder.<br>
A script can also be in a folder, or a folder in a folder, etc, inside your "my_new_resource" folder.<br><br>
The type attribute for the <script> tag, can be either "server" or "client".<br>
Server scripts run on the server, client scripts run on the client.<br>
Different scripting functionality is provided for the server and the client.<br><br>
The language attribute for the <script> tag, can be "javascript", "lua", or "squirrel".<br>
A resource can use multiple languages, if desired.<br>
It is also possible to transfer data between different languages, both in the same resource or in different resources, if desired.<br><br>
6,834

edits