Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: IF logic for ph_comsendstring Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Brandon
Newbie
Newbie
Avatar

Joined: December 29 2009
Location: United States
Online Status: Offline
Posts: 36
Posted: September 12 2010 at 20:25 | IP Logged Quote Brandon

I am having trouble with getting the following code to work.

IF(ph_getglobal_n("LEVEL1") > ph_getglobal_n("LEVEL1_THRESHOLD") AND "{THRESHOLDLVL1TYPE}" = "ATTENTION", ph_comsendstring(1, "254\8"), ph_comsendstring(1, "254\0"))

LEVEL1 - number from 1-100
LEVEL1_THRESHOLD - number from 1-100
THRESHOLDLVL1TYE - string

Bt
Back to Top View Brandon's Profile Search for other posts by Brandon
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: September 13 2010 at 09:05 | IP Logged Quote BeachBum

Which part is not working?

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Brandon
Newbie
Newbie
Avatar

Joined: December 29 2009
Location: United States
Online Status: Offline
Posts: 36
Posted: September 13 2010 at 10:12 | IP Logged Quote Brandon

BeachBum wrote:
Which part is not working?


Beach:

The IF logic is not working.

IF(ph_getglobal_n("LEVEL1") > ph_getglobal_n("LEVEL1_THRESHOLD") AND "{THRESHOLDLVL1TYPE}" = "ATTENTION",

The ph_comsendstring commands work fine (previously tested).
Back to Top View Brandon's Profile Search for other posts by Brandon
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: September 13 2010 at 10:38 | IP Logged Quote BeachBum

When I tested it I found if the case of "ATTENTION" was different than the global "attention" it would fail.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Brandon
Newbie
Newbie
Avatar

Joined: December 29 2009
Location: United States
Online Status: Offline
Posts: 36
Posted: September 13 2010 at 12:43 | IP Logged Quote Brandon

BeachBum wrote:
When I tested it I found if the case of "ATTENTION" was different than the global "attention" it would fail.


I have the cases matching ATTENTION = ATTENTION.

It seems very straightforward.

Bt
Back to Top View Brandon's Profile Search for other posts by Brandon
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: September 13 2010 at 13:41 | IP Logged Quote BeachBum

This is what I plugged in:

IF(ph_getglobal_n("LEVEL1") > ph_getglobal_n("LEVEL1_THRESHOLD") AND "{THRESHOLDLVL1TYPE}" = "attention", 0, 1)

The global values where:
LEVEL1 = 10
LEVEL1_THRESHOLD = 8
THRESHOLDLVL1TYPE = attention

I received back 0. If I change the formula to ATTENTION I receive back a 1.


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
Brandon
Newbie
Newbie
Avatar

Joined: December 29 2009
Location: United States
Online Status: Offline
Posts: 36
Posted: September 13 2010 at 21:27 | IP Logged Quote Brandon

BeachBum wrote:
This is what I plugged in:

IF(ph_getglobal_n("LEVEL1") > ph_getglobal_n("LEVEL1_THRESHOLD") AND "{THRESHOLDLVL1TYPE}" = "attention", 0, 1)

The global values where:
LEVEL1 = 10
LEVEL1_THRESHOLD = 8
THRESHOLDLVL1TYPE = attention

I received back 0. If I change the formula to ATTENTION I receive back a 1.


Beach:

I found the problem. doh!

The 254 in the ph_comsendstring needs a "\" before it as well so "\254\8" instead of "254\8" has it working.

Thanks,
Bt
Back to Top View Brandon's Profile Search for other posts by Brandon
 

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