Difference between revisions of "Legacy:EvaluateSystemScript"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110804045041/http://www.spheredev.org/wiki/EvaluateSystemScript)
 
(Cleanup)
Line 1: Line 1:
 
+
The EvaluateSystemScript(filename) command will execute the [[system scripts|system script]] called "filename." All the possible system scripts available are located in the <var>/system/scripts</var> directory of the Sphere installation.
 
 
The EvaluateSystemScript(filename) command will execute the system script called "filename." All the possible system scripts available are located in the /system/scripts directory of the Sphere installation.
 
  
 
__TOC__
 
__TOC__
  
 
==Usage==
 
==Usage==
{{Usage|returns={{{returns}}}|object={{{object}}}|func=EvaluateSystemScript|params=filename}}
+
{{Usage|func=EvaluateSystemScript|params=filename}}
  
* '''param1''' type. param1 description
+
* '''filename''' string. The name of the system script file to be run.
* '''param2''' type. param2 description
 
* '''paramN''' type. paramN description
 
  
 
==Examples==
 
==Examples==
(examples with syntaxhighlighted code)
+
<syntaxhighlight>
 +
EvaluateSystemScript("time.js");
 +
 
 +
function game()
 +
{
 +
  var font = GetSystemFont();
 +
  font.drawText(0,0, "This line is shown first");
 +
  FlipScreen();
 +
  Delay(2000);
 +
  font.drawText(0,0, "Then this line is shown 2 seconds later.");
 +
  FlipScreen();
 +
  GetKey();
 +
}
 +
</syntaxhighlight>
 +
 
 +
 
 +
<syntaxhighlight>
 +
EvaluateSystemScript("menu.js");
 +
 
 +
function game()
 +
{
 +
  // This shows a basic menu
 +
  var menu = new Menu();
 +
 
 +
  menu.addItem("Start New Game",    NewGame);
 +
  menu.addItem("Exit",        Exit);
 +
  menu.execute(250, 400, 140, 30);
 +
}
 +
</syntaxhighlight>
  
 
==Notes==
 
==Notes==
(notes)
+
There are many [[system scripts]] available, though the above two mentioned the most commonly used. The purpose of these scripts is to give inexperienced users of Sphere some common, easy to use commands to use in their games. As a user's experience with Sphere increases, they will tend to make their own versions of these to tailor to the specific needs of their game. Apart from that, system scripts provide general purpose library functions, that might be useful to everyone.
  
 
==See also==
 
==See also==
* see also
+
* [[API:EvaluateScript|EvaluateScript]](filename)
* see also
+
* [[API:RequireScript|RequireScript]](filename)
* see also
+
* [[API:RequireSystemScript|RequireSystemScript]](filename)
* etc
+
* Category [[:Category:Scripts|Scripts]]

Revision as of 00:59, 2 June 2013

The EvaluateSystemScript(filename) command will execute the system script called "filename." All the possible system scripts available are located in the /system/scripts directory of the Sphere installation.

Usage

EvaluateSystemScript(filename);


  • filename string. The name of the system script file to be run.

Examples

EvaluateSystemScript("time.js");

function game()
{
  var font = GetSystemFont();
  font.drawText(0,0, "This line is shown first");
  FlipScreen();
  Delay(2000);
  font.drawText(0,0, "Then this line is shown 2 seconds later.");
  FlipScreen();
  GetKey();
}


EvaluateSystemScript("menu.js");

function game()
{
  // This shows a basic menu
  var menu = new Menu();

  menu.addItem("Start New Game",    NewGame);
  menu.addItem("Exit",        Exit);
  menu.execute(250, 400, 140, 30); 
}

Notes

There are many system scripts available, though the above two mentioned the most commonly used. The purpose of these scripts is to give inexperienced users of Sphere some common, easy to use commands to use in their games. As a user's experience with Sphere increases, they will tend to make their own versions of these to tailor to the specific needs of their game. Apart from that, system scripts provide general purpose library functions, that might be useful to everyone.

See also