[HELP] I'm working on a position aware Custom Toast task
Hi all, I'm working on a custom Toast/Flash task, through which a new toast is positioned vertically upwards if a toast is already flashing.
To track if a toast is already being displayed I am using a count (%Toast_count) and a state profile which is active when %Toast_count > 0.
Here is the project. It has the main task 'POSITION FLASH', three tasks to create test toasts, and a debug to quickly reset %Toast_count to 0. There's also the profile 'POSITION FLASH' which I described above.
However, the project is not working properly. New toast does get shifted upwards sequentially, but the count doesn't get reduced. I have also tried setting collision handling in the profile task to 'Run Both Together'. No luck.
Need some help.
Taskernet link: https://taskernet.com/shares/?user=AS35m8kchB%2BWHBCULXKQZoBHxBzUFNOZuKtVmsq9Lj2FKL8MaFi4RlSCwYs%2Bc%2BacVzTcrJE%3D&id=Project%3ATOAST
Edit: Btw, %dur, %white, and %black are project variables; the latter two being #FFFFFFFF and #FF000000.
Project: TOAST
Profiles
Profile: POSITION TOAST
State: Variable Value [ %Toast_count > 0 ]
Enter Task: Anon
Settings: Run Both Together
A1: Wait [
MS: %dur
Seconds: 0
Minutes: 0
Hours: 0
Days: 0 ]
If [ %dur Set ]
A2: Variable Subtract [
Name: %Toast_count
Value: 1
Wrap Around: 0 ]
Tasks
Task: Debug: Reset Count
A1: Variable Set [
Name: %Toast_count
To: 0
Structure Output (JSON, etc): On ]
Task: Flash Test 1
A1: Perform Task [
Name: POSITION FLASH
Priority: %priority
Parameter 1 (%par1): Test position 1
Parameter 2 (%par2): 8000
Structure Output (JSON, etc): On ]
Task: Flash Test 2
A1: Perform Task [
Name: POSITION FLASH
Priority: %priority
Parameter 1 (%par1): Test position 2
Parameter 2 (%par2): 7000
Structure Output (JSON, etc): On ]
Task: Flash Test 3
A1: Perform Task [
Name: POSITION FLASH
Priority: %priority
Parameter 1 (%par1): Test position 3
Parameter 2 (%par2): 6000
Structure Output (JSON, etc): On ]
Task: POSITION FLASH
Variables: [ %base_position:has value %black:has value %white:has value ]
A1: Variable Set [
Name: %dur
To: %par2
Structure Output (JSON, etc): On ]
A2: Variable Set [
Name: %toast_position
To: %base_position + 60*%Toast_count
Do Maths: On
Max Rounding Digits: 3
Structure Output (JSON, etc): On ]
A3: If [ %darkModeEnabled ~ true ]
A4: Flash [
Text: %par1
Tasker Layout: On
Background Colour: %white
Timeout: %dur
Continue Task Immediately: On
Text Colour: %black
Dismiss On Click: On
Position: Bottom,0,%toast_position
Use HTML: On ]
A5: Else
A6: Flash [
Text: %par1
Tasker Layout: On
Background Colour: %black
Timeout: %dur
Continue Task Immediately: On
Text Colour: %white
Dismiss On Click: On
Position: Bottom,0,%toast_position
Use HTML: On ]
A7: End If
A8: Variable Add [
Name: %Toast_count
Value: 1
Wrap Around: 0 ]