TodayPlus Boards v2

TodayPlus for the Pocket PC Forums => Help and Support => Topic started by: ya1950 on February 19, 2004, 10:09:03 AM

Title: Help with if ... then
Post by: ya1950 on February 19, 2004, 10:09:03 AM
Could someone help me understand why this code isn't working? I'm trying to toggle sunrise/sunset times with moonphases. All I get is a blank page ????

if,var,var16,0,><,0
image,45,2,sunrise.png,t
suntime,1,sunrise,official,68,4,HH:mm,,,l
image,45,15,sunset.png,t
suntime,1,sunset,official,68,17,HH:mm,,,l
button,45,2,13,19,-1,6,var16=1,0  


else
calcvar,var30,moonphase,1
if,var,var30,,=,0
image,45,2,Moon0.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,1
image,45,2,Moon1.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,2
image,45,2,Moon2.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,3
image,45,2,Moon3.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,4
image,45,2,Moon4.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,5
image,45,2,Moon5.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,6
image,45,2,Moon6.png,t
button,45,2,13,19,-1,6,var16=0,0
else
if,var,var30,,=,7
image,45,2,Moon7.png,t
button,45,2,13,19,-1,6,var16=0,0
endif
endif
endif
endif
endif
endif
endif
endif


Thanks in advance to whoever can help.

ya1950
Title: Help with if ... then
Post by: LightMan on February 19, 2004, 10:15:08 AM
You're missing an endif inside the first "major" else, I think.

I counted 7 endifs and 8 if cycles ;)
Title: Help with if ... then
Post by: Broesel on February 19, 2004, 10:54:02 AM
That's exactly what I think, i could see strange things happen by
forgetting an endif (parts of the screen or the whole screen disappears)
and in the moon-code there have to be 8 endifs. (as you are adding an
if command you have to add an endif too)

Greetings Broesel
Title: Help with if ... then
Post by: ya1950 on February 19, 2004, 11:17:15 AM
Thanks, I didn't see that. Unfortunately it still doesn't show. The page flashes briefly on the screen and then disappears. When I cut out this code the page displays fine. Obviously it doesn't like this code. Any other ideas??
Title: Help with if ... then
Post by: LightMan on February 19, 2004, 11:50:15 AM
Quote from: ya1950Thanks, I didn't see that. Unfortunately it still doesn't show. The page flashes briefly on the screen and then disappears. When I cut out this code the page displays fine. Obviously it doesn't like this code. Any other ideas??

Are you adding this code in a region only for this, or does that region have something else?
If it has, maybe there's some conflict with other on-screen elements present on that region?

Also, you can try some debugging, by using the text command to display contents of the vars as you go through each cycle. Than might help you figure out if the vars are as they should be.
Title: Help with if ... then
Post by: ya1950 on February 19, 2004, 12:33:13 PM
It's in a region with a lot of other stuff. I agree there is a conflict here but I can't for the life of me figure out what it is. There isn't a max # of var that can be used per region is there??

I'm going to put this away for now. Maybe it will come clear when I look at it again later.

Thanks
Title: Help with if ... then
Post by: Broesel on February 19, 2004, 12:43:34 PM
For me it helped, to move the complete Moon / Sun-Code more up or down
in that region (region 0 by me) try to cut and paste it to another place in the
region.

Greetings Broesel
Title: Help with if ... then
Post by: ya1950 on February 19, 2004, 12:51:21 PM
OK, I lied, I can't put this down  :D  If I force the moon stuff to show by

initvar,var16,1

Then it's ok. Well almost - it shows the moon phase but doesn't toggle the sun times. So the problem is with the sun stuff (initvar,var16,0). Does this ring a bell with anyone ??? Thanks.
Title: Help with if ... then
Post by: Broesel on February 19, 2004, 01:15:59 PM
Hmmm, only a try, change

if,var,var16,0,><,0

to

if,var,var16,,=,0

:?:

Greetings Broesel
Title: Help with if ... then
Post by: ya1950 on February 19, 2004, 02:52:28 PM
Nope. I thought of that already, but thanks. OK, now I really am going to leave this for now. I suspect that I may have to make a separate region for this to get it to work but I'm still curious as to why it doesn't. Thanks for all the help.  :)