When writing scripts it is possible to address the variables that are located in other sections of scrip using namespace.

Connecting the scripts in file logic.xml

<import-script id="512" name="Script with variable" path="scripts/test_namespace_1.txt"/>

<item addr="512:247" name="Script" type="script" path="scripts/test_namespace_2.txt"/>

File test_namespace_1.txt:

//File test_namespace_1.txt:

namespace test;
u8 testVar = 15;

//File test_namespace_2.txt:

namespace test;
V-ID/V-ADDR
{
	srvError("%d", testVar);
}
	
//Result:



namespace S1;
namespace test;
u8 testVar = 15;
namespace S2;
namespace test;

512/512:247 
{
   srvError("%d", testVar);
}
	
        

The result of performing the example

When clicking the element script in the server log the following message will be displayed:
512:247.0: 15

512:247.0: 15

Notes:

1. Scripts with the variables are required to declare before the scripts where they are used, for example, if declare the script “test_namespace_2.txt” first and only after it “test_namespace_1.txt” the result of compilation will be the following

namespace S1;
namespace test;

512/512:247
{
	srvError("%d", testVar);
}

namespace S2;
namespace test;

u8 testVar = 15;

that would lead to error. Namespace functions only within one device