• Welcome to TodayPlus Boards v2.
 

Help with if ... then

Started by ya1950, February 19, 2004, 10:09:03 AM

Previous topic - Next topic

ya1950

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

LightMan

You're missing an endif inside the first "major" else, I think.

I counted 7 endifs and 8 if cycles ;)
[size=9]-= Ipaq 2215, 1 Gb CF, 512 Mb SD, Crystal Clear case =-[/size]

Broesel

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

ya1950

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??

LightMan

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.
[size=9]-= Ipaq 2215, 1 Gb CF, 512 Mb SD, Crystal Clear case =-[/size]

ya1950

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

Broesel

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

ya1950

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.

Broesel

Hmmm, only a try, change

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

to

if,var,var16,,=,0

:?:

Greetings Broesel

ya1950

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.  :)