Cycling through custom areas

You can use some custom script to cycle through things. Here is an example using the new "Real Java Script" action (requires latest BTT):

async function cycleThrough () {

let variableName = 'windowMoveCounter';;
let variable = await callBTT('get_number_variable', {variable_name: variableName});;

	if(variable === undefined) {
		await callBTT('set_number_variable', {variable_name: variableName, to: 1});
		variable = 1;
	}
		
	if(variable == 1) {
		callBTT('trigger_named_async_without_response', {trigger_name: 'moveLeft'});
	} else if(variable == 2) {
		callBTT('trigger_named_async_without_response', {trigger_name: 'moveRight'});
	} else if(variable == 3) {
		callBTT('trigger_named_async_without_response', {trigger_name: 'moveTop'});
	} else if(variable == 4) {
		callBTT('trigger_named_async_without_response', {trigger_name: 'moveBottom'});
	} else if(variable % 5 == 0) { 
		await callBTT('set_number_variable', {variable_name: variableName, to: 0});
		variable = 0;
	}

	// increase the variable callBTT
	await callBTT('set_number_variable', {variable_name: variableName, to: variable+1});


    // return to BTT
	returnToBTT(variable);

}


cycleThrough();

It cycles through the values 0-4 and triggers different named triggers while doing that. These named triggers need to be defined in the "Named & Other Triggers" section and also allow you to trigger a custom snap area (or use the "Custom resize/move" action.)

1 Like