<?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: Subroutine Defining a Parameter in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294972#M2947</link>
    <description>If you want the script to stop as soon as 'state =1' then is it just a matter of adding an 'END' statement directly after?&lt;BR /&gt;
&lt;BR /&gt;
i.e.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;state = 1
END&lt;/PRE&gt;

&lt;BR /&gt;
You can have more than one 'END' in a script.&lt;BR /&gt;
&lt;BR /&gt;
Otherwise wrap your initial code in an 'if state = 0 then ... endif'&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
    <pubDate>Mon, 08 Apr 2019 01:13:08 GMT</pubDate>
    <dc:creator>Barry Kelly</dc:creator>
    <dc:date>2019-04-08T01:13:08Z</dc:date>
    <item>
      <title>Subroutine Defining a Parameter</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294971#M2946</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hi,&lt;BR /&gt;
&lt;BR /&gt;
I am trying to define a parameter (Boolean) either yes or no depending on the result of a subroutine.&lt;BR /&gt;
&lt;BR /&gt;
Here is a simplified bit of my script.&lt;BR /&gt;

&lt;PRE&gt;		line1X1 = x[10]: line1Y1 = y[10]	! S1 segment
			line1X2 = x[1]: line1Y2 = y[1]
			line2X1 = x[8]: line2Y1 = y[8]	! S2 segment
			line2X2 = x[7]: line2Y2 = y[7]
			T = (line1X1-line1X2) * (line2Y1-line2Y2) - (line1Y1-line1Y2) * (line2X1-line2X2)
			gosub "T"

			line1X1 = x[1]: line1Y1 = y[1]	! S1 segment
			line1X2 = x[10]: line1Y2 = y[10]
			line2X1 = x[9]: line2Y1 = y[9]	! S2 segment
			line2X2 = x[8]: line2Y2 = y[8]
			T = (line1X1-line1X2) * (line2Y1-line2Y2) - (line1Y1-line1Y2) * (line2X1-line2X2)
			gosub "T"

!***************************************************************************************
END
!***************************************************************************************

"T":
	E= 0.00000001
	if (T &amp;gt; 0.00000000001) or (T &amp;lt; -0.000000001)then
		temp1 = line1X1 * line1Y2 - line1Y1 * line1X2
		temp2 = line2X1 * line2Y2 - line2Y1 * line2X2
		tempx = temp1 * (line2X1-line2X2) - (line1X1-line1X2) * temp2
		tempy = temp1 * (line2Y1-line2Y2) - (line1Y1-line1Y2) * temp2
		cx = (tempx / T)
		cy = (tempy / T)
if(cx&amp;gt;=min(line1X1,line1X2)-E)and(cx&amp;lt;=max(line1X1,line1X2)+E)and(cx&amp;gt;=min(line2X1,line2X2)-E)and(cx&amp;lt;=max(line2X1,line2X2)+E)and(cy&amp;gt;=min(line1Y1,line1Y2)-E)and(cy&amp;lt;=max(line1Y1,line1Y2)+E)and(cy&amp;gt;=min(line2Y1,line2Y2)-E)and(cy&amp;lt;=max(line2Y1,line2Y2)+E)then
	state = 1
else
	state = 0
endif
endif
return

&lt;/PRE&gt;

This would be fine, however I have 100+ different gosubs rather than just 1 so my script will run the gosub once and that one might make state = 1 but the next time it does a gosub it can obviously make it 0 so it cancels out. I want to be able to essentially stop the script when state = 1. How can I achieve this? (This script has been written in the parameter script) &lt;BR /&gt;
&lt;BR /&gt;
Any help would be extremely appreciated!&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Apr 2019 14:21:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294971#M2946</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2019-04-05T14:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine Defining a Parameter</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294972#M2947</link>
      <description>If you want the script to stop as soon as 'state =1' then is it just a matter of adding an 'END' statement directly after?&lt;BR /&gt;
&lt;BR /&gt;
i.e.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;state = 1
END&lt;/PRE&gt;

&lt;BR /&gt;
You can have more than one 'END' in a script.&lt;BR /&gt;
&lt;BR /&gt;
Otherwise wrap your initial code in an 'if state = 0 then ... endif'&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Mon, 08 Apr 2019 01:13:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294972#M2947</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2019-04-08T01:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine Defining a Parameter</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294973#M2948</link>
      <description>Hi Barry, &lt;BR /&gt;
&lt;BR /&gt;
well that's what I assumed but it was not working at all for some reason that I couldn't seem to work out.&lt;BR /&gt;
&lt;BR /&gt;
I had to copy and paste my extremely large amount of code into my 3D script to get my object to do what I wanted.&lt;BR /&gt;
&lt;BR /&gt;
Having an end in a subroutine in the parameter script just didn't work.</description>
      <pubDate>Mon, 08 Apr 2019 10:43:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294973#M2948</guid>
      <dc:creator>JGoode</dc:creator>
      <dc:date>2019-04-08T10:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Subroutine Defining a Parameter</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294974#M2949</link>
      <description>I wasn't really thinking at the time.&lt;BR /&gt;
An END in the parameter script will probably just stop the parameter script from running - maybe not a good idea.&lt;BR /&gt;
The other scripts will still run - so this may not be the best solution.&lt;BR /&gt;
Maybe checking the 'state' before going to the gosubs would be the way to go&lt;BR /&gt;
&lt;BR /&gt;
I think an END in the master script will stop everything - so use with caution there.&lt;BR /&gt;
&lt;BR /&gt;
Moving the code and gosubs to the 3D script is fine if you just want to set a variable value in that script only, but you can't set a parameter value there.&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Tue, 09 Apr 2019 01:12:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Subroutine-Defining-a-Parameter/m-p/294974#M2949</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2019-04-09T01:12:49Z</dc:date>
    </item>
  </channel>
</rss>

