Foldit Wiki
(Created page with " ==band.SetGoalLength== '''Function:''' void band.SetGoalLength(integer bandIndex, number length)<br />'''Description:''' Set the goal length of a band. (Range 0.0 to 10000.0)<b...")
 
m (Use LuaFunctionDetail template.)
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{LuaFunctionDetail|returns=void|namespace=band|functionname=SetGoalLength|arguments=(integer bandIndex, number length)|description=Set the goal length of a band. (Range 0.0 to 10000.0)|oldfunctionname=band_set_length|}}
 
 
==band.SetGoalLength==
 
'''Function:''' void band.SetGoalLength(integer bandIndex, number length)<br />'''Description:''' Set the goal length of a band. (Range 0.0 to 10000.0)<br />'''V1 Function Name:''' band_set_length
 
   
 
== Remarks ==
 
== Remarks ==
  +
This is the "unstretched" or "true" length of the band. If the current length of the band (as set by [[Foldit_Lua_Function_band.Add|band.Add]] or read by [[Foldit_Lua_Function_band.GetLength|band.GetLength]]) is less than the goal length, the band will push the endpoints apart. If the current length is more than the goal length, it will pull the endpoints closer.
 
   
 
== Sample ==
 
== Sample ==
   
 
This script sets the length of all bands to 0.
 
This script will set lenght of all bands to 0.
 
   
 
<pre>
 
<pre>
for i=1, band.GetCount() do
+
for ii = 1, band.GetCount () do
band.SetGoalLength(i,0)
+
band.SetGoalLength ( ii, 0)
 
end
 
end
 
</pre>
 
</pre>
  +
[[Category:Script tutorial]]

Revision as of 03:26, 19 January 2018

band.SetGoalLength

Function
void band.SetGoalLength(integer bandIndex, number length)
Description
Set the goal length of a band. (Range 0.0 to 10000.0)
V1 Function Name
band_set_length

Remarks

This is the "unstretched" or "true" length of the band. If the current length of the band (as set by band.Add or read by band.GetLength) is less than the goal length, the band will push the endpoints apart. If the current length is more than the goal length, it will pull the endpoints closer.

Sample

This script sets the length of all bands to 0.

for ii = 1, band.GetCount () do
    band.SetGoalLength ( ii, 0) 
end