One-liner to calculate the binary value to toggle, enable, or disable an option via Java Function or Tasker Settings:
%val = ceil((abs(%val - 1) + %par(#?1/on/true) - %par(#?0/off/false))/(2+%par(#)))
(Where %val is the binary value of the current state, if retrieved). Thus allows toggling if mo parameters are passed and absolute stating by a passed parameter.
- One-liner to extract a base-12 hour from Tasker’s base-24 %TIME variable:
-
%hour = floor(%TIME) - floor(%TIME/13)*12 + floor(abs(floor(%TIME) - 24)/24)*12
The first segment extracts the hour by discarding the minutes; the second segment subtracts any p.m. offset (from 13.00 to 23.00); the third segment converts midnight (00:00) to 12.