Allow a button 'on touch' to update an integer attribute with only one (1) before save...

Hi there - having a problem I hope someone can shed some light on...
A bit long text so stating the problem on top here...
Question: How can I constrain a button - which when allowed to be pressed - to only add one (1) integer to my integer attribute?
Example: I go to day 4 and press button green and then saves that - this updates my summary screen and next day is unlocked and all is well...
...but let's assume that I later go back to take a look at that day and fiddles around and press that button again!!! Then my GameDayScore will be increased even though that's not true and a new day will be unlocked!
Have tried to summarize this below - the more I type the more I understand my own problem - so - sorry for the lengthy discussion!
Situation:
The summary scene:
- I have a summary screen showing day icons where each icon can be clicked if 'game.gameday' ≥'self.gameday'
- Each day icon changes to unlocked as the gameDay attribute adds +1
The game day scene:
- On this scene I want to do the following
Top section,
- A text actor has a default instruction to: display text "This is game day"..game.gameDay
Middle section,
- A text actor displaying an instruction to press one of four buttons
(- I have also experimented with [if] self.isPressed is true)
- Each button updates a specific integer attribute i.e (game.i_Did_It) to (game.i_Did_It +1)
- Depending on which button is pressed the above text actor display the text string correlated to the button
Bottom section,
- Here is a Save button which is supposed to do two things
- 1. Check which of the four buttons was pressed and save that value
- 2. Save the current day (which has unlocked next level)
Info:
I'm using the following types of attributes:
Game: gameDay (integer which simply keeps track on which game day it is)
Game: isReported (boolean which is supposed to control the 'SaveTheDay' button (but I aint sure of this one yet))
Game: dayType (integer (it's actually four of this attribute) controlling what type of day it was i.e green, yellow, red))
PS. Have been using both 20-ish scenes which gives each day an own scene - but - am now trying to control all this from one single GameDay scene where I want to hook up all logic to the game.gameDay index/attribute.
Again - sorry for the lengthy text...
A bit long text so stating the problem on top here...
Question: How can I constrain a button - which when allowed to be pressed - to only add one (1) integer to my integer attribute?
Example: I go to day 4 and press button green and then saves that - this updates my summary screen and next day is unlocked and all is well...
...but let's assume that I later go back to take a look at that day and fiddles around and press that button again!!! Then my GameDayScore will be increased even though that's not true and a new day will be unlocked!
Have tried to summarize this below - the more I type the more I understand my own problem - so - sorry for the lengthy discussion!
Situation:
The summary scene:
- I have a summary screen showing day icons where each icon can be clicked if 'game.gameday' ≥'self.gameday'
- Each day icon changes to unlocked as the gameDay attribute adds +1
The game day scene:
- On this scene I want to do the following
Top section,
- A text actor has a default instruction to: display text "This is game day"..game.gameDay
Middle section,
- A text actor displaying an instruction to press one of four buttons
(- I have also experimented with [if] self.isPressed is true)
- Each button updates a specific integer attribute i.e (game.i_Did_It) to (game.i_Did_It +1)
- Depending on which button is pressed the above text actor display the text string correlated to the button
Bottom section,
- Here is a Save button which is supposed to do two things
- 1. Check which of the four buttons was pressed and save that value
- 2. Save the current day (which has unlocked next level)
Info:
I'm using the following types of attributes:
Game: gameDay (integer which simply keeps track on which game day it is)
Game: isReported (boolean which is supposed to control the 'SaveTheDay' button (but I aint sure of this one yet))
Game: dayType (integer (it's actually four of this attribute) controlling what type of day it was i.e green, yellow, red))
PS. Have been using both 20-ish scenes which gives each day an own scene - but - am now trying to control all this from one single GameDay scene where I want to hook up all logic to the game.gameDay index/attribute.
Again - sorry for the lengthy text...
Comments
Your idea to use the device.clock.day is great and I will incorporate that - but - more from a reporting standpoint.
But even if I use the game clock it won't solve the problem - but - maybe I'm closer to a solution now - I'm thinking like this:
1. I will keep one scene for each day (for now at least)
2. I will add a text box displaying 'This day has been reported'
3. I will somehow incorporate an 'Edit button' for which type of day it was which doesn't affect the game.gameday index
4. The edit button must behave in such a way that it only adds one (1) to whichever type of day the user reports since this goes to statistics
5. I need some type of rule for the 'SaveTheDay' button which allows it to update the game.gameday index only once
5.1 (I can never control whether the user reports one or several days per each reporting occasion - but - the 'SaveTheDay' button takes the user back to 'Summary view'
6. I'm thinking of 'destroy_this_actor' regarding the 'SaveTheDay' button - this way it will only live once in the game.
So basically I have a number of actions I want to tie to a 'GameDay'. It should be possible for the user to alter/edit his choices - somehow I should try to build a dialogue which asks the user to confirm his choices and when pressing 'Confirm' the different attributes should be updated.
It's a hard thing not being a programmer - but - it's also fun to test out different solutions :-)
thx again
Some rule like this perhaps:
rule: [if] game.gameday=17
display."this_is_gameday"..game.gameday
rule-when-pressing-'whichTypeOfDay'
change.behaviour (game.WhatTypeOfDayWasThis) to (game.WhatTypeOfDayWasThis) +1)%4
[if[ (game.WhatTypeOfDayWasThis)=1 [then]
display.txt.ThisWasAGreenDay
change attribute [game.GreenDay) to (game.GreenDay +1)
otherwise
[if[ (game.WhatTypeOfDayWasThis)=2 [then]
display.txt.ThisWasAYellowDay
change attribute [game.YellowDay) to (game.YellowDay +1)
otherwise
[if[ (game.WhatTypeOfDayWasThis)=2 [then]
display.txt.ThisWasARedDay
change attribute [game.RedDay) to (game.RedDay +1)
etc...
My challenge here would be to only allow this sequence to happen once - i.e - I can't let the user come back and add to the different scores time after time...
...but I should allow them to edit their choices i.e change a green day to a red day.
Maybe i need to add some type of minus score when doing that?
ok - those were early sunday reflections - now - back to work!