Calling Scripts From Other Scripts

Calling scripts from other scripts

Includes some basic how-to call a script from another script and namespace explanations

- When calling scripts in other gsc's or csc's:

- Add #using pathandnameoffile

- Use either the name of the file, before it, or the namespace used before the functions you want, followed by two colons (::) and then the function name.

- In the zone file for you map you will need to add the script that has the functions in it you want to call.

Example below is for zm or zombiemode scripts:

  • The gsc mc_test, with the following inside:
#namespace testing;  
function test(name)
{
     wait(5);
     iPrintLnBold(name); 
} 
#using scripts\zm\mc_test; 
level testing::test("MakeCents");
    or
level thread testing::test("MakeCents"); 
scriptparsetree,scripts/zm/mc_test.gsc 
  • In your script you will call it from you will need at the top:
  • Where you want to call the function you will:
  • Open the zone file for your map in a text editor and locate the other related scripts, gsc or csc and add:

Only link need selected and build