I ought to leave a better answer. You can handle functionality on a button press if the value of its channel changes. Like so:
; get button channel
kWifi cabbageGetValue "btnWifi"
; update image on button press - check if value of channel changes
if changed(kWifi) == 1 then
; check if button is on
if kWifi == 1 then
cabbageSet 1, "image_of_wifi3", "visible", 1
cabbageSet 1, "image_of_wifi1", "visible", 0
else ; button is off
cabbageSet 1, "image_of_wifi3", "visible", 0
cabbageSet 1, "image_of_wifi1", "visible", 1
endif
endif
This way cabbageSet
won’t murder your runtime. You can further improve this by multiplying the value of 1 or 0 you pass for “visible” by kWifi
so you don’t need another if-else check.
if changed(kWifi) == 1 then
cabbageSet 1, "image_of_wifi3", "visible", 1 * kWifi
cabbageSet 1, "image_of_wifi1", "visible", 1 - 1 * kWifi
endif
In hindsight, this can also work if you make kWifi
a sort of “light indicator” for if your effect is functioning or not (bad Wi-Fi signal-gate triggered).