Difference between revisions of "Custom scripts"

From Spherical
Jump to: navigation, search
(created)
 
m (fix link)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
It's not always necessary to reinvent the wheel - browse the [[Scripts|Script]] category to see whether or not some of the scripts could be of use to you. To include a custom script in your game, resort to one of these methods:
+
It's not always necessary to reinvent the wheel - browse the [[:Category:Scripts|Script]] category to see whether or not some of the scripts could be of use to you. To include a custom script in your game, resort to one of these methods:
* Copy it into the script folder of your game and place [[RequireScript]]('filename.js') on top of your main script. This method is especially recommended if you want to distribute your game or program without the engine. '''OR:'''
+
* Copy it into the script folder of your game and place [[API:RequireScript|RequireScript]]('filename.js') on top of your main script. This method is especially recommended if you want to distribute your game or program without the engine. '''OR:'''
* Copy the script to <var>%SPHERE_ROOT%\common\</var> and reference via [[RequireScript]]('/common/filename.js'). Scripts and files placed inside the mentioned directory will be available to all games of your Sphere installation. '''OR:'''
+
* Copy the script to <var>%SPHERE_ROOT%\common\</var> and reference via [[API:RequireScript|RequireScript]]('/common/filename.js'). Scripts and files placed inside the mentioned directory will be available to all games of your Sphere installation. '''OR:'''
* Copy it to <var>%SPHERE_ROOT%/system/scripts</var> and reference via [[RequireSystemScript]]('filename.js'). It'll be be usable as if it was a [[system script]] that comes with Sphere.
+
* Copy it to <var>%SPHERE_ROOT%/system/scripts</var> and reference via [[API:RequireSystemScript|RequireSystemScript]]('filename.js'). It'll be be usable as if it was a [[system scripts|system script]] that comes with Sphere.
  
 
==See also==
 
==See also==
* Category: [[Scripts]]
+
* [[:Category:Scripts]]
 
* [[System scripts]]
 
* [[System scripts]]
* [[RequireScript]]()
+
* [[API:RequireScript|RequireScript]]()
  
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Latest revision as of 02:50, 2 June 2013

It's not always necessary to reinvent the wheel - browse the Script category to see whether or not some of the scripts could be of use to you. To include a custom script in your game, resort to one of these methods:

  • Copy it into the script folder of your game and place RequireScript('filename.js') on top of your main script. This method is especially recommended if you want to distribute your game or program without the engine. OR:
  • Copy the script to %SPHERE_ROOT%\common\ and reference via RequireScript('/common/filename.js'). Scripts and files placed inside the mentioned directory will be available to all games of your Sphere installation. OR:
  • Copy it to %SPHERE_ROOT%/system/scripts and reference via RequireSystemScript('filename.js'). It'll be be usable as if it was a system script that comes with Sphere.

See also