<NME> describe-inventory.cocoascript
<BEF> 
function DescribeInventory () {}


DescribeInventory.sectionView = function() { return "# View" + ln() }
DescribeInventory.sectionModel = function() { return "# Model" + ln() }
DescribeInventory.sectionCustom = function() { return "# Custom" + ln() }



DescribeInventory.generateStateSection = function(layerName, generatedStates) {
	if (generatedStates == nil || generatedStates.length == 0) { return "" }

	var stateSectionName = GenerateInventory.clearName(layerName) + ".states =" + ln()
	var stateBottomSection = ln()

	var states = ""
	for (var i = 0; i < generatedStates.length; i++) {
		var correctBeginString = generatedStates[i].replace(" {, ", "")
		correctBeginString = correctBeginString.replace(" {", "")
		correctBeginString = correctBeginString.replace("}", "")

		if (userDefaults.myDetailedNotation == 1)	{
			correctBeginString = correctBeginString.replace(/\t/g, tln() + tln())
		}
		else {
			correctBeginString = correctBeginString.replace(/:/g, ": ")
			correctBeginString = correctBeginString.replace(": ", ": { ")
			correctBeginString = correctBeginString.replace(/:  /g, ": ")
			correctBeginString += " }"
		}

		states += tln() + correctBeginString + ln()
	}

	return stateSectionName + states + stateBottomSection
}

DescribeInventory.generateState = function(stateName, stateContent) {
	if (stateContent == "" || stateContent == nil || stateContent == '') { return "" }
	return "\"" + GenerateInventory.clearName(stateName) + "\"" + ": {" + stateContent + "}"
}


DescribeInventory.generateStateSwitchInstant = function(layerName, stateName) {
	return "" + GenerateInventory.clearName(layerName) + ".stateSwitch(\"" + GenerateInventory.clearName(stateName) + "\")" + dln()
}

DescribeInventory.generateRetinaVariable = function() {
	return ""
	// if (userDefaults.myRetinaEnabled == 0) { return "" }
	// if (scaleInstance == nil) { scaleInstance = new ScaleInventory() }
	// return userDefaults.myRetinaString + " = " + scaleInstance.returnScaleCode() + ln()
}

DescribeInventory.generatePhoneModel = function() {
	var model = userDefaults.myDevice
	var modelDescription = ""

	if (model == 2) {
		modelDescription += "Framer.Device.deviceType = \"apple-iphone-5s-space-gray\"" + ln()
	}
	else if (model == 3) {
		modelDescription += "Framer.Device.deviceType = \"apple-iphone-6s-space-gray\"" + ln()
	}
	else if (model == 4) {
		modelDescription += "Framer.Device.deviceType = \"apple-iphone-6s-plus-space-gray\"" + ln()
	else if (model == 6) {
		modelDescription += "Framer.Device.deviceType = \"google-nexus-6p\"" + ln()
	}
	return modelDescription
}



function getButtonName() {
	return "cycleButton"
}

function getButtonName() {
	return "cycleButton"
}

DescribeInventory.generateCycleButton = function() {
	return getButtonName() + " = new Layer width: Screen.width, height: Screen.height, backgroundColor: \"transparent\"" + dln()
}



function getCycleArrayName() {
	return "statesFromArtboards"
}

DescribeInventory.generateCycleStates = function(states) {
	var cycleStatesDescription = getCycleArrayName() + " = ["
	for (var i = 0; i < states.length; i++) {
		cycleStatesDescription += "\"" + GenerateInventory.clearName(states[i]) + "\""
		if (i != states.length - 1) { cycleStatesDescription += ", "}
	}


function getLayersArrayName() {
	return "items"
}

DescribeInventory.generateLayers = function(layers) {
	return "sceneItems"
}

DescribeInventory.generateLayers = function(layers) {
	var layersDescription = getLayersArrayName() + " = ["
	for (var i = 0; i < layers.count(); i++) {
		var layerName = [[layers objectAtIndex: i] name]
		layersDescription += GenerateInventory.clearName(layerName)
		if (i != layers.count() - 1) { layersDescription += ", "}
	}
	layersDescription += "]" + ln()
	return layersDescription

}



function getCyclerName() {
	return "cycler"
}

DescribeInventory.generateCycler = function() {
	var cyclerDescription = getCyclerName() + " = Utils.cycle(" + getCycleArrayName() + ")" + ln()
	cyclerDescription += "nextState = " + getCyclerName() + "()" + dln()
	return "runSimulation"
}


DescribeInventory.generateHandler = function() {
	var handlerDescription = ""

	if (userDefaults.myAutoplay == 0) {
		handlerDescription = getButtonName() + ".on Events.Click, ->" + ln()
		handlerDescription += tln() + "nextState = " + getCyclerName() + "()" + ln()
		handlerDescription += tln() + "for item in " + getLayersArrayName() + ln()
		handlerDescription += tln() + tln() + "try" + ln()
		handlerDescription += tln() + tln() + tln() + "item.animate(nextState)" + ln()
		handlerDescription += tln() + tln() + "catch error" + dln()
	}
	else {
		handlerDescription = getFunctionName() + " = () ->" + ln()
		handlerDescription += tln() + "nextState = " + getCyclerName() + "()" + ln()
		handlerDescription += tln() + "for item in " + getLayersArrayName() + ln()
		handlerDescription += tln() + tln() + "try" + ln()
		handlerDescription += tln() + tln() + tln() + "item.animate(nextState)" + ln()
		handlerDescription += tln() + tln() + "catch error" + ln()
		handlerDescription += tln() + "Utils.delay 2, ->" + ln()
		handlerDescription += tln() + tln() + getFunctionName() + "()" + dln()

		handlerDescription += getFunctionName() + "()"
	}
	return handlerDescription
}
	handlerDescription += tln() + getHandlerName() + "()"

	return handlerDescription
}

<MSG> Updated Describe Inventory for Scene

– updated states cycler with a handler (helps skipping some states)
– added helpers to disable hints & proper desktop cursor
– renamed itemsArray to stay connected with action name
– removed a part with autoplay

<DFF> @@ -68,11 +68,17 @@ DescribeInventory.generatePhoneModel = function() {
 	else if (model == 6) {
 		modelDescription += "Framer.Device.deviceType = \"google-nexus-6p\"" + ln()
 	}
-	return modelDescription
+	return modelDescription + getHelpers(model)
 }
 
 
 
+function getHelpers(model) {
+	var helpers = "Framer.Extras.Hints.disable()" + ln()
+	if (model == 0 || model == 1) { helpers += "document.body.style.cursor = \"auto\"" + ln() }
+	return helpers
+}
+
 function getButtonName() {
 	return "cycleButton"
 }
@@ -100,7 +106,7 @@ DescribeInventory.generateCycleStates = function(states) {
 
 
 function getLayersArrayName() {
-	return "items"
+	return "sceneItems"
 }
 
 DescribeInventory.generateLayers = function(layers) {
@@ -131,29 +137,22 @@ function getFunctionName() {
 	return "runSimulation"
 }
 
+function getHandlerName() {
+	return "nextStateHandler"
+}
 
 DescribeInventory.generateHandler = function() {
 	var handlerDescription = ""
 
-	if (userDefaults.myAutoplay == 0) {
-		handlerDescription = getButtonName() + ".on Events.Click, ->" + ln()
-		handlerDescription += tln() + "nextState = " + getCyclerName() + "()" + ln()
-		handlerDescription += tln() + "for item in " + getLayersArrayName() + ln()
-		handlerDescription += tln() + tln() + "try" + ln()
-		handlerDescription += tln() + tln() + tln() + "item.animate(nextState)" + ln()
-		handlerDescription += tln() + tln() + "catch error" + dln()
-	}
-	else {
-		handlerDescription = getFunctionName() + " = () ->" + ln()
-		handlerDescription += tln() + "nextState = " + getCyclerName() + "()" + ln()
-		handlerDescription += tln() + "for item in " + getLayersArrayName() + ln()
-		handlerDescription += tln() + tln() + "try" + ln()
-		handlerDescription += tln() + tln() + tln() + "item.animate(nextState)" + ln()
-		handlerDescription += tln() + tln() + "catch error" + ln()
-		handlerDescription += tln() + "Utils.delay 2, ->" + ln()
-		handlerDescription += tln() + tln() + getFunctionName() + "()" + dln()
-
-		handlerDescription += getFunctionName() + "()"
-	}
+	handlerDescription += getHandlerName() + " = () ->" + ln()
+	handlerDescription += tln() + "nextState = " + getCyclerName() + "()" + ln()
+	handlerDescription += tln() + "for item in " + getLayersArrayName() + ln()
+	handlerDescription += tln() + tln() + "try" + ln()
+	handlerDescription += tln() + tln() + tln() + "item.animate(nextState)" + ln()
+	handlerDescription += tln() + tln() + "catch error" + dln()
+
+	handlerDescription += getButtonName() + ".on Events.Click, ->" + ln()
+	handlerDescription += tln() + getHandlerName() + "()"
+
 	return handlerDescription
 }

Updated Describe Inventory for Scene