Difference between revisions of "Legacy:EvaluateSystemScript"

From Spherical
Jump to: navigation, search
(Cleanup)
(added navbox)
 
Line 47: Line 47:
 
* [[API:RequireSystemScript|RequireSystemScript]](filename)
 
* [[API:RequireSystemScript|RequireSystemScript]](filename)
 
* Category [[:Category:Scripts|Scripts]]
 
* Category [[:Category:Scripts|Scripts]]
 +
 +
{{API:Script/navbox}}

Latest revision as of 02:20, 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

API:Script/navbox