• Welcome to TodayPlus Boards v2.
 

Rotating 'if' statement

Started by grayme, October 16, 2004, 03:56:07 PM

Previous topic - Next topic

grayme

I've been trying to adapt part of Wichtel's Hammerskin so that the rotating Memory/Battery icon goes through Battery, System Memory and then SD Card, however I cannot make it show all three, it will only show regions 45,1 and 45,3, it ignores the second 'if'.

I am sure that there must be a simple thing missing, but I've been struggling with this one all day!  :oops: Can anyone see what is missing please?

Thanks in advance :-)

Graham

initvar,var17,0 //Battery - Memorychange
.
.
.
.
.
//=================================
// Battery - Memory
//=================================
Region,4,0,4

if,var,var17,,=,0
jumpregion,45,1
storevar,var17=1
else
if,var,var17,,=,1
jumpregion,45,2
storevar,var17=2
else
if,var,var17,,=,2
jumpregion,45,3
storevar,var17=0
endif
endif
endif

/Battery========================

region,45,1,-1

image,34,46,meters_background.png,t
battery,bar,36,46,52,13,gradient_batterymain gradient.png
image,34,46,meters.png,t

imagebutton,34,46,Metersbutton.png,tr,-1,0,%apps-6-2-highlight

changefont,tahoma,11

if,batterystatusunknown
image,0,35,batterie_unbekannt.png,t
text,62,36,Batt: ?,c
else

if,charging
image,0,35,batterie_laden.png,t
text,62,36,Charging.....,c
else

if,externalpower,=,true
image,0,35,batterie_geladen.png,t
text,62,36,AC Power,c
else
image,0,35,batterie.png,t
battery,remaining,62,36,Batt: , %,c
endif
endif
endif

changefont,tahoma,12

endregion,45,1


//Memory ============================

region,45,2,-1

changefont,tahoma,11

memory,storagefree,55,36,, MB,l
memory,programfree,55,36,,-,r

image,34,46,meters_background.png,t
memory,barused,36,46,52,13,gradient_Speichermain gradient.png
image,34,46,meters.png,t

imagebutton,34,46,Metersbutton.png,tr,-1,0,%apps-6-3-highlight

calcvar,var19,programmemoryusedpercent

if,var,var19,1,><,50
image,0,35,Speicherleer.png,t
else

if,var,var19,51,><,80
image,0,35,Speichervoll.png,t
else
image,0,35,Speicherhot.png,t
endif
endif

changefont,tahoma,12

endregion,45,2




// SD CARD==========================================


region,45,3,-1

changefont,tahoma,11
image,5,38,sd.png,t

image,34,46,meters_background.png,t
storage,2,bar,36,46,52,13,gradient_storage gradient.png
image,34,46,meters.png,t

imagebutton,34,46,Metersbutton.png,tr,-1,0,%apps-6-5-highlight

storage,2,free,62,36,, MB,c


endregion,45,3

endregion,4,0

uk_skinner

QuoteI've been trying to adapt part of Wichtel's Hammerskin so that the rotating Memory/Battery icon goes through Battery, System Memory and then SD Card, however I cannot make it show all three, it will only show regions 45,1 and 45,3, it ignores the second 'if'.

I think you missed one "else".

if,var,var17,,=,0
  jumpregion,45,1
  storevar,var17=1
else
  if,var,var17,,=,1
     jumpregion,45,2
     storevar,var17=2
else
     if,var,var17,,=,2
        jumpregion,45,3
        storevar,var17=0
else
     endif
  endif
endif

grayme

Thankyou, but alas I've tried adding another 'else' but it hasn't helped.  :?

Could it be caused by the same thing that overlays the icon of the SD card over the battery so that you can still see the battery icon underneath, and vice versa (i.e. some missing option up above)?

uk_skinner

Quote from: graymeThankyou, but alas I've tried adding another 'else' but it hasn't helped.  :?

Could it be caused by the same thing that overlays the icon of the SD card over the battery so that you can still see the battery icon underneath, and vice versa (i.e. some missing option up above)?

Possible, then use the cleararea code at beginning or region.  Erase the images before you put the new ones.

grayme

Quote from: uk_skinner
Quote from: graymeThankyou, but alas I've tried adding another 'else' but it hasn't helped.  :?

Could it be caused by the same thing that overlays the icon of the SD card over the battery so that you can still see the battery icon underneath, and vice versa (i.e. some missing option up above)?

Possible, then use the cleararea code at beginning or region.  Erase the images before you put the new ones.

Thankyou uk_skinner, solved the overlaying problem, unfortunately it's not affected the ignoring of the middle item.

Is there an alternative way to rotate three (or more) items?

Thanks

Wichtel

@ grayme
Please, pack the Skintext into a Zipfile and append it to your Posting.I then have a look at it tonight.
Greetings Wichtel 
 

miwi-media.com | Web & Screendesign

grayme

Thankyou Wichel.

Now I feel really cheeky as I've been trying to adapt part of your skin to that which is mostly rbg08's OSX skin!  :oops:

I'd be really grateful if you could help, but I'd understand if you'd prefer not to.

Thanks


EDIT to remove icons

jhollin1138

The only thing I can think of to try is to remove the last "If, then, else" since you don't need it.

if,var,var17,,=,0
  jumpregion,45,1
  storevar,var17=1
else
  if,var,var17,,=,1
     jumpregion,45,2
     storevar,var17=2
  else
     jumpregion,45,3
     storevar,var17=0
  endif
endif


I agree with Wichtel, it would be more if helpful you would post the entire skin file.  There might be a problem with it outside the section you posted.

Edit: Here is another thought, have you tried changing the order and see if you can get region 2 to load at all?  Maybe something like this:

if,var,var17,,=,0
  jumpregion,45,1
  storevar,var17=1
else
  if,var,var17,,=,2
     jumpregion,45,3
     storevar,var17=0
  else
     jumpregion,45,2
     storevar,var17=2
  endif
endif


If region 2 still won't load, then there might be a problem with it.
Jim H

grayme

Thanks Jim.

Just tried taking out the final if and endif lines, but it's not helped.  :cry:

It doesn't appear to be the middle section to blame as I currently have it working as you suggested (the uploaded skin file is actually this way around), so it does appear to be something to do with the if's.

I have changed a variable from var17 within the middle section as it appeared to be used separate from the intial if, I thought this could have been the problem but it hasn't helped.

As they say, a little knowledge is a dangerous thing, I'm learning but nowhere near the likes of you lot!  :P

uk_skinner

Quote from: graymeThanks Jim.

Just tried taking out the final if and endif lines, but it's not helped.  :cry:

It doesn't appear to be the middle section to blame as I currently have it working as you suggested (the uploaded skin file is actually this way around), so it does appear to be something to do with the if's.

I have changed a variable from var17 within the middle section as it appeared to be used separate from the intial if, I thought this could have been the problem but it hasn't helped.

As they say, a little knowledge is a dangerous thing, I'm learning but nowhere near the likes of you lot!  :P

I used another approach and it worked.  Here were what I did.

initvar,var17,0   //Battery - Memorychange
initvar,var16,0

// BEGIN ON MAIN PAGE
initregion,0,500
initregion,10,0
initregion,5,0
initregion,1,0
//initregion,15,0
.
.
...

//if,var,var17,,=,0
//   jumpregion,15,1
//   storevar,var17=1
//   cleararea,0,35,30,25
//else
//if,var,var17,,=,1
//jumpregion,15,2
//      storevar,var17=2
//      cleararea,0,35,30,25
//else
//      if,var,var17,,=,2
//         jumpregion,15,3
//         storevar,var17=0
//      endif
//   endif
//endif

   /Battery========================
if,var,var17,,=,0
//   region,15,1,-1
      image,34,35,meters_background.png,t
      battery,bar,36,35,52,13,gradient_batterymain gradient.png
      image,34,35,meters.png,t

      imagebutton,34,35,Metersbutton.png,tr,-1,0,%apps-6-2-highlight

      changefont,tahoma,11

      if,batterystatusunknown
         image,0,24,batterie_unbekannt.png,t
         text,62,25,Batt: ?,c
      else

         if,charging
            image,0,24,batterie_laden.png,t
            text,62,25,Charging.....,c
         else

            if,externalpower,=,true
               image,0,24,batterie_geladen.png,t
               text,62,25,AC Power,c
            else
               image,0,24,batterie.png,t
               battery,remaining,62,25,Batt: , %,c
            endif
         endif
      endif
   
   
   changefont,tahoma,12   
   storevar,var17=1
//   endregion,15,1

else
if,var,var17,,=,1


   //Memory ============================
//   region,15,2,-1

      changefont,tahoma,11

      memory,storagefree,55,25,, MB,l
      memory,programfree,55,25,,-,r

image,34,35,meters_background.png,t
      memory,barused,36,35,52,13,gradient_Speichermain gradient.png
      image,34,35,meters.png,t
   
      imagebutton,34,35,Metersbutton.png,tr,-1,0,%apps-6-3-highlight
   
      calcvar,var16,programmemoryusedpercent

      if,var,var16,1,><,50
         image,0,24,Speicherleer.png,t
      else

         if,var,var16,51,><,80
            image,0,24,Speichervoll.png,t
         else
            image,0,24,Speicherhot.png,t
         endif
      endif
      
      changefont,tahoma,12
   storevar,var17=2

//   endregion,15,2
else
if,var,var17,,=,2



// SD CARD==========================================
//region,15,3,-1
      changefont,tahoma,11
   image,5,27,sd.png,t

   image,34,35,meters_background.png,t
   storage,2,bar,36,35,52,13,gradient_storage gradient.png
   image,34,35,meters.png,t

   imagebutton,34,35,Metersbutton.png,tr,-1,0,%apps-6-5-highlight

   storage,2,free,62,25,, MB,c
   
   storevar,var17=0
//endregion,15,3
else
endif
endif
endif

endregion,0,500

I commented out all your jumpregion codes and use if, else, endif to rotate the system information..

One more thing, I changed your var171 to var16.

grayme

Thankyou, I'll give it a go and let you know how I get on.

Thankyou for all of your help.  :D

jhollin1138

In my old skin, found here I was rotating my SD and CF card.  So to test if I could have a third, I added an additional Memory section.  Sure enough, it will cycle through all 3 sections.  Not that it really helps you, at least it proves that you can.  (I would attach and Animated GIF, but my software is on my home PC and I am work.)

Here is my relevant code:

if,var,var17,,=,0
if,storage,1
jumpregion,2,0
else
if,storage,2
jumpregion,2,100
else
jumpregion,2,10
endif
endif
storevar,var17=1
else
if,var,var17,,=,1
if,storage,2
jumpregion,2,100
else
if,storage,1
jumpregion,2,0
else
jumpregion,2,10
endif
endif
storevar,var17=2
else
jumpregion,2,101
storevar,var17=0
endif
endif

region,2,0,-1  //SD Card
image,160,2,sd0.png,t
button,160,0,27,22,2,4,0,8
draw,roundrect,183,11,46,9,-1_6_-1,h
storage,1,bar,185,13,42,5,gradient_green-red gradient.png
storage,1,used,207,0,, MB,c
button,161,0,70,24,9,4,300-highlight,8
endregion,2,0

region,2,100,-1  //CF Card
image,160,2,cf0.png,t
button,160,0,27,22,2,4,0,8
draw,roundrect,183,11,46,9,-1_6_-1,h
storage,2,bar,185,13,42,5,gradient_green-red gradient.png
storage,2,used,207,0,, MB,c
button,161,0,70,24,9,4,400-highlight,8
endregion,2,100

region,2,10,-1  //No Storage Card
image,160,2,no storage.png,t
draw,roundrect,183,11,46,9,-1_6_-1,h
draw,roundrect,185,13,42,5,0_0_0,
text,207,0,None,c
endregion,2,10

region,2,101,-1  //Memory Section
image,160,0,memory.png,t
button,160,0,27,22,2,4,100,8
draw,roundrect,183,11,46,9,-1_6_-1,h
memory,barused,185,13,42,5,gradient_green-red gradient.png
memory,totalused,207,0,, MB,c
button,161,0,70,24,9,4,200-highlight,8
endregion,2,101


Here is the skin file, if you need it:
Jim H

grayme

:D

Thankyou all, I've managed to get it working with this:


if,var,var17,,=,0
jumpregion,6,0
storevar,var17=1
else
  if,var,var17,,=,1
jumpregion,6,1
storevar,var17=2
else
jumpregion,6,2
storevar,var17=0
endif
endif


Basically, I took out the third 'if', I guess you don't need one at the end which makes sense.   :roll:

Now to add some more button functionality and I can't wait for those radar images, I've got a couple of tabs to fill!  :)