How to once to declare and initialize variable for many GDL elements
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-27 10:32 AM
2019-05-27
10:32 AM
dim my_array[]
my_array[1]="1"
my_array[2]="2"
Count of the my_array items can be changed in time to development aims.
And need to use it in any my GDL elements of the library.
How I can declare andi initialize this array once for all my elements?
Help me please(.
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-27 11:23 AM
2019-05-27
11:23 AM
I have never tried it on multiple objects.
Maybe the LP_XMLConverter can do this - I have never used it but I believe it can reset variables in multiple elements.
I may be mistaken though - as i say i have never used it.
Otherwise you will need to do it individually in each object.
I have done this in an object I made so I can easily reset all the array values back to default while I am testing or changing the object.
Create a boolean parameter called "reset_defaults_swch"
Then add this to the master script (it may work in the parameter script as well, but for some reason I have it in the master script"
You could do it without the boolean switch but you would have to manually uncomment/comment the lines otherwise it will always be initialising.
Barry.
Maybe the LP_XMLConverter can do this - I have never used it but I believe it can reset variables in multiple elements.
I may be mistaken though - as i say i have never used it.
Otherwise you will need to do it individually in each object.
I have done this in an object I made so I can easily reset all the array values back to default while I am testing or changing the object.
Create a boolean parameter called "reset_defaults_swch"
Then add this to the master script (it may work in the parameter script as well, but for some reason I have it in the master script"
if reset_defaults_swch = 1 then dim my_array[] my_array[1]="1" my_array[2]="2" parameters my_array = my_array reset_defaults_swch = 0 parameters reset_defaults_swch = reset_defaults_swch endifNow just turn on the boolean parameter in the parameter list - it will turn back of instantly but will have reset your array.
You could do it without the boolean switch but you would have to manually uncomment/comment the lines otherwise it will always be initialising.
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-28 09:27 AM
2019-05-28
09:27 AM
Probably LibraryGlobal is a key - can be changed by MVO and then injected to the calling object.
Piotr
Piotr

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-28 09:51 AM
2019-05-28
09:51 AM
Piotr wrote:I was going to mention Library Globals and MVO but I ended up deleting it.
Probably LibraryGlobal is a key - can be changed by MVO and then injected to the calling object.
Piotr
That will work for resetting values in placed instances of the objects but not the object default (script) values themselves.
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2019-05-28 12:41 PM
2019-05-28
12:41 PM
Ok, I missed the "main" part.
So there is another way but the XML tool:
- make an object with desired parameters and values
- set it as a template
- apply the template to the desired objects...
(delete the template when necessary ... when deleted it will be allowed to change the template without deleting the previously inserted parameters)
Piotr
So there is another way but the XML tool:
- make an object with desired parameters and values
- set it as a template
- apply the template to the desired objects...
(delete the template when necessary ... when deleted it will be allowed to change the template without deleting the previously inserted parameters)
Piotr