UGX-Mods

Call of Duty: Black Ops 3 => Tutorial Desk => Scripting => Topic started by: MakeCents on October 04, 2016, 01:22:21 pm

Title: Calling a script from another script
Post by: MakeCents on October 04, 2016, 01:22:21 pm

    This tut 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:
Code Snippet
Plaintext
#namespace testing;

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

     Only link need selected and build
Title: Re: Calling a script from another script
Post by: HitmanVere on October 04, 2016, 01:33:37 pm
This was something I tried only once and didnt know what to do. Going to follow this next time Im going to add new script. Good and on-point tut!
Title: Re: Calling a script from another script
Post by: MakeCents on October 04, 2016, 01:36:43 pm
This was something I tried only once and didnt know what to do. Going to follow this next time Im going to add new script. Good and on-point tut!

Cool, I was gonna add my on connect explanation too, in another tut. Think that would be helpful?
Title: Re: Calling a script from another script
Post by: HitmanVere on October 04, 2016, 01:51:48 pm
Cool, I was gonna add my on connect explanation too, in another tut. Think that would be helpful?

Definitely. Some Alpha Testers had problems (if i remember correctly) about things not connecting probably, so definitely would be helpful to new comers as well
Title: Re: Calling a script from another script
Post by: gamer9294 on October 05, 2016, 09:16:14 am
great tutorial man, good job  ;)  8)

best regards,
Gamer9294