autoStrength:
if isInit == null
isInit = true # Use a temporary variable inside the listener for initialization
# It will only run once on the very first frame of the listener
# Let's assume the fixed point is your position when the listener starts
# (Note: This line now only runs on the first frame!)
areaRemocon = CreateArea(type="sphere", stage=_state.Position.stage, x=_state.Position.x, y=_state.Position.y, z=_state.Position.z, r=0.1, compass=false)
# Now, areaRemocon is a fixed point
# Your if/elseif/else logic will now work correctly
if areaRemocon.Distance() < 10
strength = "High"
elseif areaRemocon.Distance() < 30
strength = "Low"
else
strength = "Off"
if prev != strength
SetVibrator(strength)
Log("VibratorSensor: " + strength)
prev = strength
if _state.Items.VibeRemocon > 0
thread.Goto("haveRemote")