Unless it was added in a very recent version, walker scripts never had CP variables
which is why your script won't work.
An available option is to do it at packet level.
catch StatusUpdate(0x0E) packets, look for CurrentCP/MaxCP fields (0x21 and 0x22 respectively)
If the CP% is below whatever threshold you assign, you have two options to actually use the CP pots
By getting the object ID of your CP potions from the ItemList(0x1B) packet and sending a UseItem with that,
or if you want to make it simpler, you may do a cheap walker script hack, by crafting a StatusUpdate for say, SP, with a set value.
Then in walker script, you CharStatus(SP,==,yourvalue){useitem ...