I agree, easy one to get stuck on. (Also am a professional programmer for a living). I too spent many hours stuck on X=GetValue(X, 1) when it should have been X=GetValue("X",1).
Agree this is non intuitive, and ideally at least a warning should be raised in the editor. (would have saved a few hours of my life
I note this post is a few years old. What is the current status?
Can you recommend the best way for a simple toggle? For example, I am wishing to create a simple voice activated toggle for my Philips Hue lights. Can you please reccomend the best way to maintain state for a toggle function?
I am currently attempting to use just this:
Global_LightsState=GetValue("Global_LightsState", true)
Global_LightsState= NOT Global_LightsState
Does this code seem correct to you? What is your reccommended Best Technique to have a simple Flow that effectively toggles/alternates a setting each time it is run?
(FYI the reason for this is faked Intelligence for the voice activation. I.e instead of having two voice activated flows "Lights On" and "Lights Off", I prefer to to be thoughtful and state dependent.
i.e if I say "mumble mumble lights blah mumble", and the lights are already On, clearly that means I want them off! and vice versa. i.e I will never say "Lights On" if the lights are already on.
Also, this has the benefit of effectively improving the voice recognition positive hit rate, as there is less to process (correctly).
Appreciate your advice on the best way to maintain a state/toggle.
EDIT: Ah, solved my problem: adding the quotes, and realising Java is case sensitive: changed Global_ to global_. Given that your product (which is excellent by the way! just switched from Tasker) will be used my many non or beginner programmers, and there will never be a realistic need for "Global_", how about another compiler warning message?
Also, is this your recommended way to maintain state?