Author |
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 08 2007 at 13:33 | IP Logged
|
|
|
how do I increment/decrement a global variable within a macro?
Thanks!
/j
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 08 2007 at 14:08 | IP Logged
|
|
|
Probably a few ways to do it, but check out the ph_addtoglobal function ...
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 08 2007 at 16:39 | IP Logged
|
|
|
umm, yeah - if it handles negative values as well -
that'll do it.
thanks!
/j
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 08 2007 at 17:50 | IP Logged
|
|
|
It does.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 08 2007 at 17:54 | IP Logged
|
|
|
not in the obvious way, I needed to do...
ph_addtoglobal("SLEEPINCNT",double(-1))
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 09 2007 at 10:12 | IP Logged
|
|
|
Yeah, I could see that from an end user point of view. From a programmer's or a computer's point of view, all math is fundamentally addition. In most APIs and what not, it gets a little cumbersome to wrap variants like subtraction, et al. It's a fairly standard paradigm, but I see what you mean. Just wait until you play with various DateTime APIs and to find yesterday, you add -1 days. :)
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 09 2007 at 10:33 | IP Logged
|
|
|
sounds like you know your stuff, bh -I'm surprised you can't help me with..
http://www.power-home.com/forum/forum_posts.asp?TID=1548&PN= 1
8-}
/j
Edited by jeffw_00 - December 09 2007 at 10:34
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 09 2007 at 11:54 | IP Logged
|
|
|
The problem with negative numbers is that they *must* have a space before and after the negative to work properly (not my restriction but the language Im programming in). Sometimes it works if you don't include the spaces, but for maximum compatibility, it's best to just always put them there. So it should work like this:
ph_addtoglobal("SLEEPINCNT", - 1)
HTH,
Dave.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 09 2007 at 11:55 | IP Logged
|
|
|
oh, well that's, ummm, so obvious 8-} (not!)
seriously - thanks for the tip, ain't computers ergonomic?
thanks Dave 8-}
/j
Edited by jeffw_00 - December 09 2007 at 11:55
|
Back to Top |
|
|
bhlonewolf Senior Member
Joined: March 29 2007
Online Status: Offline Posts: 198
|
Posted: December 09 2007 at 12:21 | IP Logged
|
|
|
jeffw_00 wrote:
sounds like you know your stuff, bh -I'm surprised you can't help me with..
http://www.power-home.com/forum/forum_posts.asp?TID=1548&PN= 1
8-}
/j |
|
|
Ha! Well, I'm a computer programmer and you're likely running some of my code now :} ... but when it comes to HA and PH, I'm a noob. Some of it translates easily, but some stuff not so easily!
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 09 2007 at 12:26 | IP Logged
|
|
|
Well, - I design chips for consumer products (used to design computers way back), so you may be using some of my stuff too 8-}
on the other - Dave, as always, had the answer
/j
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: December 09 2007 at 12:32 | IP Logged
|
|
|
Well that puts me out of the "Do Loop" I come from the Main Frames days. Ever heard of MVS, QTAM, BTAM and how about old DOS?
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: December 09 2007 at 12:37 | IP Logged
|
|
|
heard of MVS (I think), still use DOS
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: December 09 2007 at 12:48 | IP Logged
|
|
|
Nope.. different DOS. Before PCs all the way back to TOS (Tape Operating System) then DOS (Disk Operating System) and SVS (Single Virtual Storage) then MVS (Multiple Virtual Storage) and VM (Virtual Machine).
__________________ Pete - X10 Oldie
|
Back to Top |
|
|