Copy to Clipboard Test

Random Combo Cycle Code

@InitD0("Delay"),
@InitDHelp0("How many frames to wait before switching to a random combo."),
@InitD1("Combo 1"),
@InitDHelp1("If >0, this combo will be added to the pool."),
@InitD2("Combo 2"),
@InitDHelp2("If >0, this combo will be added to the pool."),
@InitD3("Combo 3"),
@InitDHelp3("If >0, this combo will be added to the pool."),
@InitD4("Combo 4"),
@InitDHelp4("If >0, this combo will be added to the pool."),
@InitD5("Combo 5"),
@InitDHelp5("If >0, this combo will be added to the pool."),
@InitD6("Combo 6"),
@InitDHelp6("If >0, this combo will be added to the pool."),
@InitD7("Is range?"),
@InitDHelp7("If checked, will use Combo 1 and Combo 2 as the first and last in a range of combos to choose from.")
combodata script RandomCombo
{
	void run(int delay, int combo1, int combo2, int combo3, int combo4, int combo5, int combo6, bool isRange)
	{
		mapdata md = Game->LoadTempScreen(this->Layer);
		int cd = md->ComboD[this->Pos];
		int ocd = cd;
		do
		{
			if(delay)
				Waitframes(delay);
			if(isRange)
			{
				cd = Rand(combo1, combo2);
			}
			else
			{
				int options[6];
				int numOptions;
				if(combo1)
				{
					options[numOptions] = combo1;
					++numOptions;
				}
				if(combo2)
				{
					options[numOptions] = combo2;
					++numOptions;
				}
				if(combo3)
				{
					options[numOptions] = combo3;
					++numOptions;
				}
				if(combo4)
				{
					options[numOptions] = combo4;
					++numOptions;
				}
				if(combo5)
				{
					options[numOptions] = combo5;
					++numOptions;
				}
				if(combo6)
				{
					options[numOptions] = combo6;
					++numOptions;
				}
				cd = options[Rand(numOptions)];
			}
			md->ComboD[this->Pos] = cd;
		}while(cd==ocd);
	}
}