Author |
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 27 2007 at 23:03 | IP Logged
|
|
|
I've added this post to the programming section, posted it here by mistake.
Please excuse my ignorance here
What am I doing wrong with this macro?
10 FORMULA if("[LOCAL7]" = "DINING3",
if("[LOCAL10]" = "0",
ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:Off~~"'),
ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:On~~"')))
I've been able to get one if to work, but when I add the nested if here: if("[LOCAL7]" = "DINING3", if("[LOCAL10]" = "0", true part, false part, etc.
It doesn't seem to do anything.
Also,
What's the correct macro type when trying to nest if statements? Jump, Formula, etc.
I've been trying to understand the "Jump" type, could someone explain this as well.
Please help.
Thanks
Edited by ficklma1 - December 27 2007 at 23:10
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: December 28 2007 at 13:53 | IP Logged
|
|
|
Could it be as simple as you are missing a "false part" for the first if statement? I don't have PH in front of me, but I don't think the false statement is optional.
So you want something like:
Code:
if("[LOCAL7>" = "DINING3",
if("[LOCAL10>" = "0",
ph_run('C:\...drla mps_to ggle:Off~~"')
,
ph_run('C:\...drla mps_to ggle:On~~"')
)
,
""
) |
|
|
I tend to use GOTO instead of JUMP - this is because whith a jump statement you have to change the # of lines to skip when you insert new lines into the macro. Also the Labels do double duty as comments.
The trick with GOTO is that the label line is a string without quotes (E.g. LABEL, ... , The End), but when you reference it in a GOTO statement you have to quote it (E.g. GOTO, ... , "The End")
Often you use a formula with a JUMP or a GOTO to make a conditional jump. In that case you have a formula that resolves to a number (in the case of a JUMP) or a string (in the case of a GOTO. Something like:
Code:
GOTO, if ("[LOCAL1>"="TRUE", "True Label", "False Label")
JUMP, if ("[LOCAL1>"="TRUE", 1, 999)
|
|
|
Hope this helps.
Edited by onhiatus - December 28 2007 at 14:02
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: December 28 2007 at 13:56 | IP Logged
|
|
|
I had a slightly snarky comment about posting in the wrong place, but I just realized that I should have read your edit... my bad.
Edited by onhiatus - December 28 2007 at 13:59
|
Back to Top |
|
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 28 2007 at 22:42 | IP Logged
|
|
|
Thanks onhiatus...good explanations, I need all the help I can get.
|
Back to Top |
|
|
|
|