Tasker - turn off wifi IF there's no internet connection i can't figure it out how to do this and all other tutorials are outdated and i have not some options they do (like a check box next to the time to set variable). so please don't mark this question as duplicate.

with that said; i have a profile which turn WiFi on when i unlock my phone. i want that to also ping Google DNS and if it get time out turn WiFi off if not keep the wifi connected.
You can create a task to ping Google DNS as follows:

Task → Code  → Run Shell

Command: ping -c 2 8.8.8.8 [Store Output In: %stdout] [Continue Task After Error: checked]


  If %stdout ~ 100% packet loss
  
  google servers unreachable
  
  Else
  
  connectivity established
  
  End If




Add this to your main task with either keeps wi-fi conection or switches it off.

Credits

Run shell 'ping' with tasker