phpInDev

script_local

mixed script_local ( object object, script script, [ mixed arg0, [ ..., [ mixed arg13 ]]] )

Script local is a simple wrapper script for running scripts locally on an object. object is the object where the script script will be run. The object may be provided either as object index or as object id (as both work with "with" structure). script is the name of the script (or in fact, the ID) and all the following parameters are the arguments passed to the script (up to 14 different arguments).

The script returns the value of the script that was run, so it may either be real or string, depending on what the script itself returned.

Example 1. Using script_local

// Let's assume we have following script foo(): { testvar[0] = argument0; testvar[1] = argument1; testvar[2] = argument2; return "bar" } // And then we have object "object0" and run the following script: { retval = script_local(object0, foo, "a", "b", "c"); show_message( "retval = " + retval + chr(10) + "0 = " + object0.testvar[0] + chr(10) + "1 = " + object0.testvar[1] + chr(10) + "2 = " + object0.testvar[2] + chr(10) + ""); }

The message shown is:

retval = bar 0 = a 1 = b 2 = c

Code for script_local.gml

{
    with (argument0)
    {
        return script_execute(argument1,
            argument2, argument3,
            argument4, argument5,
            argument6, argument7,
            argument8, argument9,
            argument10, argument11,
            argument12, argument13,
            argument14, argument15
        );
    }
}