I believe this will randomly assign parameters to slots and also randomize its values for the macros handles.
Here is a direct copy of the current script available for download at https://u-he.com/PatchLib/all.html
The only problem seems to not be able to select a valid "Target" for each slot (or any slot at all).
Code: Select all
#defaults=no
<?
int fractionalType = 1;
int first_XY_Target = Core.XY[ 4 ].Down[ 8 ].id + 1;
int last_XY_Target = Global.numParameters - 1;
int iterations = 0;
for ( int xy = 1; xy < 5; xy++ )
{
for ( int slot = 1; slot < 9; slot++ )
{
int target = -1;
for ( 1; 1; 1) // same as while( true )
{
target = rand( first_XY_Target, last_XY_Target );
if ( Global.Parameter[ target ].type == fractionalType )
{
int moduleID = Global.Parameter[ target ].moduleID;
if ( Module[ moduleID ].active )
{
Core.XY[ xy ].TargetX[ slot ] = target;
float value = Global.Parameter[ target ];
float minInfluence = Global.Parameter[ target ].min - value;
float maxInfluence = Global.Parameter[ target ].max - value;
Core.XY[ xy ].Right[ slot ] = rand( minInfluence, maxInfluence );
Core.XY[ xy ].Left[ slot ] = rand( minInfluence, maxInfluence );
break;
}
}
iterations++;
}
for ( 1; 1; 1) // same as while( true )
{
target = rand( first_XY_Target, last_XY_Target );
if ( Global.Parameter[ target ].type == fractionalType )
{
int moduleID = Global.Parameter[ target ].moduleID;
if ( Module[ moduleID ].active )
{
Core.XY[ xy ].TargetY[ slot ] = target;
float value = Global.Parameter[ target ];
float minInfluence = Global.Parameter[ target ].min - value;
float maxInfluence = Global.Parameter[ target ].max - value;
Core.XY[ xy ].Up[ slot ] = rand( minInfluence, maxInfluence );
Core.XY[ xy ].Down[ slot ] = rand( minInfluence, maxInfluence );
break;
}
}
iterations++;
}
}
}
?>
Code: Select all
#defaults=no
<?
float value = Global.Parameter[ target ];
float minInfluence = Global.Parameter[ target ].min - value;
float maxInfluence = Global.Parameter[ target ].max - value;
Core.XY[ xy ].Right[ slot ] = rand( minInfluence, maxInfluence );
Core.XY[ xy ].Left[ slot ] = rand( minInfluence, maxInfluence );
?>
How to fix it ?
Thanks!