Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Need Help Debugging Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Tomcat7194
Newbie
Newbie


Joined: November 05 2006
Online Status: Offline
Posts: 24
Posted: February 01 2007 at 22:06 | IP Logged Quote Tomcat7194

Hey everyone. I'm trying to run a pretty simple bit of code, and for some reason it's not cooperating. Basically, I want a macro that checks the global variable HEATON, and if it equals 1, changes it to zero, runs and x10 command, and does a tts.

Here is the code:
Formula | Immediate| if({HEATON}=1, ph_x10btn ("3", 3, 0 ) + ph_tts("Furnace is on") + ph_setglobal_s("HEATON","0"), 0)

When I run it with HEATON set to 1, it does not chance HEATON to zero, and it doesn't do the other functions. Any idea what I'm doing wrong here?

Thanks!
Tom
Back to Top View Tomcat7194's Profile Search for other posts by Tomcat7194
 
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: February 01 2007 at 22:26 | IP Logged Quote Viper

Use:
Goto Label | if ({HEATON}=1, "HEATON", "HEATOFF")
Label | HEATON
Set Global | "HEATON" | 0
Formula | Post | ph_x10btn("3",3,0)
Formula | Post | ph_tts("Furnace is on")
Label | HEATOFF
Back to Top View Viper's Profile Search for other posts by Viper
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 07 2007 at 21:58 | IP Logged Quote dhoward

Tom,

I pasted your formula in the Multi-Editor and it worked just fine (once I created a global variable called HEATON and changed the "3" in ph_x10btn to match an X10 device in my setup) so Im not sure what the problem would be. All of the functions you're calling return integers so that is not a problem with adding them together. Have you any additional info to add?

You could also use Vipers suggestion. It should work as well.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum