<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to make infinite hostpots with array? in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333131#M4052</link>
    <description>&lt;P&gt;There is actually a critical difference.&lt;/P&gt;&lt;P&gt;In the second option the parameter "spots" has to update in the parameter list before the other scripts (2D, 3D) will use the new value.&lt;/P&gt;&lt;P&gt;In the first example the other scripts will respond directly to the "local variable" value set in the master script (spots = newspots) before the parameter value even updates. This makes the object respond dynamically especially in the case of adding new nodes (spots) on the fly in 2D and 3D.&lt;/P&gt;&lt;P&gt;In all my objects I use the first method so that effectively the 2D and 3D are reading values directly from the master script rather than the parameter values. In many cases I don't even have a parameter that relates to the master script local variable.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 11:34:28 GMT</pubDate>
    <dc:creator>Kristian Bursell</dc:creator>
    <dc:date>2022-03-23T11:34:28Z</dc:date>
    <item>
      <title>how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241115#M4048</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I want to make hotspots for changing elements position (user have to enter amount of elements).&lt;BR /&gt;&lt;BR /&gt;Is there any possibility to create array with one row and column ( arr[1]=0 ) and then, based upon users choice to expand it to another amount (for instance, 100). I understand i must initialize this array at first (to extend it to 100 and set arr = 0 ). But I don't know where I'm wrong. I assume, my arr=0 reseting all values again to zero. Any help?&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Sep 2021 11:26:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241115#M4048</guid>
      <dc:creator>A_ Smith</dc:creator>
      <dc:date>2021-09-14T11:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241116#M4049</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The hotspot command takes care of storing the moved hotspots in the parameter list.&lt;BR /&gt;You need to write code that adds new entries to the array when amount changes. You probably won't want to overwrite already existing hotspots to 0.&lt;BR /&gt;It is possible that amount decreases, but GDL can't decrease the size of arrays, a temporary array has to be created that will be copied back to the parameter.&lt;BR /&gt;This has to be done in the parameter script:&lt;/P&gt;
&lt;PRE&gt;if GLOB_MODPAR_NAME = "amount" then
	! allow decrease, vardim1 tells stored array size
	sizetokeep = min(vardim1(spots), amount)

	! copy existing hotspots
	dim newspots[]
	for i = 1 to sizetokeep
		newspots[i] = spots[i]
	next i

	! initialize new hotspots, will be skipped when decreasing size
	for i = sizetokeep + 1 to amount
		newspots[i] = 0
	next i

	! store array with new size
	spots = newspots
	parameters spots = spots
endif
&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jan 2022 11:02:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241116#M4049</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2022-01-06T11:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241117#M4050</link>
      <description>Thank you for your time and for the sophisticated solution.</description>
      <pubDate>Tue, 02 Feb 2021 09:36:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/241117#M4050</guid>
      <dc:creator>A_ Smith</dc:creator>
      <dc:date>2021-02-02T09:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333128#M4051</link>
      <description>&lt;P&gt;I want to know what is the difference, if any, of this:&lt;/P&gt;&lt;PRE&gt;spots = newspots
parameters spots = spots&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;and this:&lt;/P&gt;&lt;PRE&gt;parameters spots = newspots&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 11:01:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333128#M4051</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2022-03-23T11:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333131#M4052</link>
      <description>&lt;P&gt;There is actually a critical difference.&lt;/P&gt;&lt;P&gt;In the second option the parameter "spots" has to update in the parameter list before the other scripts (2D, 3D) will use the new value.&lt;/P&gt;&lt;P&gt;In the first example the other scripts will respond directly to the "local variable" value set in the master script (spots = newspots) before the parameter value even updates. This makes the object respond dynamically especially in the case of adding new nodes (spots) on the fly in 2D and 3D.&lt;/P&gt;&lt;P&gt;In all my objects I use the first method so that effectively the 2D and 3D are reading values directly from the master script rather than the parameter values. In many cases I don't even have a parameter that relates to the master script local variable.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 11:34:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333131#M4052</guid>
      <dc:creator>Kristian Bursell</dc:creator>
      <dc:date>2022-03-23T11:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333239#M4053</link>
      <description>&lt;P&gt;I'm a little confused. (Just started studying GDL.) Does it mean that when I use spots after parameters spots = newspots, the value will be the "old" value and not the values set by parameters statement?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 02:43:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333239#M4053</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2022-03-24T02:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333240#M4054</link>
      <description>&lt;P&gt;Let me try to explain in my non - GDL way (I am not much of a programmer although I get by).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just saying ... spots = newspots ...&lt;/P&gt;
&lt;P&gt;will change the value of the spots variable, but does not actually change the parameter that the user sees.&lt;/P&gt;
&lt;P&gt;The new variable value will be used in the scripts - but the users doesn't see it in the interface.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is why you use ... PARAMETERS spots = spots&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This sets the parameter the user sees.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just use ... PARAMETERS spots = newspots ...&lt;/P&gt;
&lt;P&gt;this will set the parameter the user sees but you have not actually set the value of the variable used in the scripts - yet.&lt;/P&gt;
&lt;P&gt;Because of the order the scripts run (they are run multiple times), the new value will not be used in the scripts until the parameter/master script is runs after the new value has been changed.&lt;/P&gt;
&lt;P&gt;So although you set the new parameter value, the 2D/3D script might not pick up on it straight away.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you set the variable value with ... spots = newspots.&lt;/P&gt;
&lt;P&gt;And then set the Parameter value with PARAMETERS spots = spots&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Barry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2022 03:18:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/333240#M4054</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2022-03-24T03:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to make infinite hostpots with array?</title>
      <link>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/334251#M4055</link>
      <description>&lt;P&gt;The &lt;EM&gt;parameters&lt;/EM&gt; and &lt;EM&gt;values&lt;/EM&gt; commands have a dirty secret: they take effect only after the parameter script ends. So if you just write&lt;/P&gt;
&lt;PRE&gt;parameters spots = newspots&lt;/PRE&gt;
&lt;P&gt;the rest of the parameter script sees the old content of spots, and could update other parameters based on that.&lt;/P&gt;
&lt;P&gt;It is not a problem if you never use it again in the parameter script, but its better to keep a habit of writing it correctly.&lt;/P&gt;
&lt;P&gt;Another habit could be to only use newspots in the parameter script after that, then the spots parameter needs to be copied at the start of the script when it isn't modified too.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 13:43:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/how-to-make-infinite-hostpots-with-array/m-p/334251#M4055</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2022-03-31T13:43:06Z</dc:date>
    </item>
  </channel>
</rss>

