I am trying to create a global variable, update and display it. My global variable is meant to store the lowest value encountered on the accelerometer's z axis, just to see what is the lowest value I can get when hitting the iPad's surface.
So, I have created my global variable using a project script :
Code: Select all
// this script is named "mini"
// Execution: on load
decl thresh;
thresh = accelerometer[2];
Code: Select all
// this script is named "check"
// Execution: on expression - accelerometer - any
if (accelerometer[2] < mini.thresh) {
setattribute(mini.thresh, 'value', accelerometer[2]);
}
return mini.thresh;
However the displayed value is 0 and never changes.
What's wrong ?