working with tables and calendar dates
so im trying to find an efficient way to extract the day of the year and match an image accordingly.
I have 365 images and wish to match them against an appropriate date so the code automatically displays the matching image. e.g. a christmas image is displayed if the app is used on dec 25.
i'm thinking of creating a table for each month, insert the name of each image file in the tables.
the next step im a little unsure of, I'm aware of the game.clock attributes but seeking advice on how i turn this data into an expression or similar to perform what im after ?
thanks.
I have 365 images and wish to match them against an appropriate date so the code automatically displays the matching image. e.g. a christmas image is displayed if the app is used on dec 25.
i'm thinking of creating a table for each month, insert the name of each image file in the tables.
the next step im a little unsure of, I'm aware of the game.clock attributes but seeking advice on how i turn this data into an expression or similar to perform what im after ?
thanks.
Best Answers
-
lukey5227 Posts: 111
Easiest way: Make each image like 0101 (for January 1st) or 1225 (for December 25th) or 0401 (for April 1st), etc. If you can make the images like this, you can just have the actor have it change its image to "Device.Clock.Month".."Device.Clock.Day". If it is May 26, It will have 05 (or maybe 5, not sure) and 26. Either 526 or 0526. Test it out...
-
MotherHoose Posts: 2,456
great! super! Awesome … @lukey5227 =D>
months are 1, 2,3, … (no leading 0) … 10, 11, 12
days are also 1, 2, 3, … (no leading 0) … 11, 20, 31
@zzap64 … lukey5227 makes it so easy for you!
name your images correctly 11, 22, 33 … 61… 1225
easiest way is to highlight in Finder … rightClick > Get Info
… and change the name … then import in GS
only one actor needed to display the dayImage:
changeAttribute: self.Image To: Device.Clock.Month..Device.Clock.Day (expression)
(the expression will say: game.Clock…)
having things happening with realTime and realDay … is exciting play!
my latest project has 2 calendars and 3 clocks … all real display
MH
Answers
i managed to figure out an alternative today using tables by having an actor self.image change to tablecellattribute.mytable.game.clock.month. game.clock.day
and seems to work dandy, i wanted to use tables as i have a lot of text to display per day as well.
i also stuck on another problem, i would like to instruct that actor to display a table cell by having the user select that table cell by hand (basically the date) by keypad entry.
e.g. user enters the date, the appropriate image appears.
I'm aware of the GS keyboard behaviour but unsure how to send this variable information to the actor that is currently changing it's self.image, do i need a new variable ?
thanks.
thankyou for you previous help, it works.
the only issue i seem to find is when using a variable to go backwards through the dates
e.g. myvariable -1 and apply that to the clock.month..clock.day it works partially.
63,62,61 works then i would it expect to goto 531 but it goes to 60, then 6-1.
any help please