Commits

factormystic committed 1638c58

Failsafe defaults in a bit less clumsy way

Comments (0)

Files changed (1)

 
 	if(temp == null)
 	{
-		alert("Creating temperature text object, with last value: "+last_temp);
-		temp = bg.addTextObject((last_temp=null?last_temp:"70°"), fonttype, 85, textcolor, 0, 0);
+		alert("Creating temperature text object");
+		if(last_temp == "")
+		{
+			last_temp = "70°";
+			alert("Setting default temp of "+last_temp);
+		}
+		
+		temp = bg.addTextObject(last_temp, fonttype, 85, textcolor, 0, 0);
 		temp.opacity = 30;
 	}
 
 	if(condition == null)
 	{
-		alert("Creating condition text object, with last value: "+last_condition);
-		condition = bg.addTextObject((last_condition!=null?last_condition.replace("AND", "/").replace("MOSTLY",""):"CLEAR"), fonttype, 60, textcolor, 0, 70);
+		alert("Creating condition text object");
+		if(last_condition == "")
+		{
+			last_condition = "FAIR";
+			alert("Setting default condition of "+last_condition);
+		}
+		
+		condition = bg.addTextObject(last_condition.replace("AND", "/").replace("MOSTLY",""), fonttype, 60, textcolor, 0, 70);
 		condition.opacity = 30;
 	}