Squirrel/Server/Functions/Scripts/LoadScript

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Removed link code that should not exist)
 
Line 12: Line 12:
 
== Example ==
 
== Example ==
  
This example will load the scripts specified in Script.xml in [[Scripts/SomeScript]] when someone types /load.
+
This example will load the scripts specified in Script.xml in Scripts/SomeScript when someone types /load.
  
 
<code lang="squirrel">
 
<code lang="squirrel">

Latest revision as of 04:00, 12 January 2012

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function will load a script folder. Note that the script folder you wish to load should be placed in the Scripts/ folder of your server.

[edit] Syntax

  1. bool LoadScript( string scriptName )

[edit] Arguments

  • scriptName - The name of the script folder

[edit] Example

This example will load the scripts specified in Script.xml in Scripts/SomeScript when someone types /load.

  1.  
  2. function onPlayerCommand( id, cmd, text )
  3. {
  4. if ( cmd == "load" )
  5. {
  6. LoadScript( "SomeScript" );
  7. Message( "SomeScript loaded!" );
  8. }
  9. return 1;
  10. }
  11.  

[edit] Notes

The function Message and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox