Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
State: wifi connected
Net -> Wifi -> set off IF %SCREEN off
Net ->Wifi -> set on IF %SCREEN on
you can do the same for mobile data if that's what you're after
edit: haven't tested or tried this, just off the top of my head

good point, you will need to create the extra variable (wifion)
the problem with the above one (i think) is that you need to implement a clear variable (for wifion) at some point, unless you always want to keep wifi 'on' in settings.
i would work on it too if i wasn't at work lol![]()
I think your solution is overly complex. Why don't you just do this?
Context:
1) Wifi Near (you can set specific parameters, or you can just leave them blank. If blank, ANY Wifi access point that is nearby will satisfy this criteria)
2) Variable %Screen = on
Task: Wifi On
Exit Task: Wifi Off
You can't use Wifi Connected, without an elaborate workaround, because when the screen turns off, the Wifi will turn off and Wifi Connected is no longer valid.

I actually use Wifi Near for all my contexts that need a location now. I ditched Network location because it doesn't work in areas where there is low signal and it's hard to get a location fix. GPS uses too much power.
I get good battery life using Wifi Near, set to poll every 10 minutes, at all times (no other contexts).
Anyway, the OP just said he wants Wifi on when the screen is on, and off when it's off. So, he technically doesn't need the Wifi Near context to do that. I just added it in to save his battery
I think this will be very battery friendly because, as you said, it should only poll whenever the screen is on, and only however X minutes are in the settings.
Anyone setting up location-based contexts should read "Location Without Tears" on the Tasker site.I actually use Wifi Near for all my contexts that need a location now.
I set my network location for 1km to turn on my wifi, so that by the time I pull into my driveway, wifi is on on the phone, and usually connected by the time I walk through the door.
Then I have set my home profile to keep wifi on as long as Wifi Near is active. Has worked well so far.
When I leave the 1km radius, wifi turns off. I tried to lower the 1km to about 500m, but that is too specific for the network, so 1km works well for me.
I used the Autoprofiles Tasker profile(s) from wikidot to do create the Wifi Near context for turning on Wifi and also doctored the corresponding profiles to suit my needs.
Anyone setting up location-based contexts should read "Location Without Tears" on the Tasker site.