GameSalad

Difficulty with a simple button, display text, and writing to tables

jbguidajbguida Posts: 8Member, BASIC

Hello again!
I am working on a sports simulator game that allows players to schedule events. I'm very new to making games, so I apologize if this is a silly question.

I have successfully achieved a few of the necessary steps, however I've run into the following troubles. I'll do my best to be as clear as possible.

I'm working with three tables: EventsSchedule, Cities and Venues.

Players see three "DisplayText" actors: One for the week that they are scheduling an event, one for the city and one for the venue.

Around each display text actor are arrows that allow the player to cycle through their various options. The WeekDisplayText actor works on a global attribute I call FutureWeekIndex. It is set in a rule as the variable for the current week +1. Clicking on the arrows around the text moves that variable one up or one down.

The same set up works for the City Display Text Actor and the Venue Display Text Actor. These arrows, instead of working with numbers, cycle their own indexes through the tables "Cities" and "Venues."

At the bottom of the screen is a button "Confirm" which is an actor that is meant to lock the options selected by the user into a row in the "EventsSchedule" table. Which row is determined by the "FutureWeekIndex" attribute. The city and the venue are added to the appropriate columns and a third column, which is an integer (because I can't seem to figure out how test booleans), is changed from 0 to 1. This third column is meant to indicate if events for that week have been "confirmed" or not.

The difficulty arises when I click this button. If I try to change the week forward or back by clicking the arrows that adjust the week, the "EventsSchedule" table updates and changes the "confirmed" box from 0 to 1, and I am stuck with whatever City/Venue is visible. I'm pretty sure this is what is happening as I've run a debugger and found that the column meant to check whether an event is confirmed or not registers as 1 whenever I click the buttons intended only to change the week.

If someone can help with this set up, I'd be very grateful. Alternatively, if someone can come up with a work around so that players can cycle through weeks, cities, and venues before something is confirmed, but then have the appropriate display text actors locked once the player has confirmed their choice (and have these choices stored in the appropriate table), I'd also be very grateful.

My apologies that this is so long. Here is the code if it is faster
:
Actor 1: WeekDisplay
Change Attribute: set game.FutureWeekIndex to game.CurrentWeekIndex + 1
Display Text: Display "Week "..game.FutureWeekIndex

Actor 2:FutureCityName
Rule:
If tableCellValue(game.EventsSchedule [table], game.FutureWeekIndex [row], 78 [column] = 0
Do: Display tableCellValue(game.Cities[table], game.FutureCityIndex [row], 1 [column])
If tableCellValue(game.EventsSchedule [table], game.FutureWeekIndex [row], 78 [column] = 1
Do: Display tableCellValue(game.EventsSchedule[table], game.FutureWeekIndex[row], 2 [column]

Actor 3: FutureCityVenue
If tableCellValue(game.EventsSchedule [table], game.FutureWeekIndex[row], 78 [column] = 0
Do: Display tableCellValue(game.Venues[table], game.FutureVenueIndex[row], 1 [column])
If tableCellValue(game.EventsSchedule [table], game.FutureWeekIndex [row], 78 [column] = 1
Do: Display tableCellValue(game.EventsSchedule[table], game.FutureWeekIndex[row], 3 [column]

Actors 4 and 5, 6 and 7, 8 and 9 (buttons for cycling through the above Display Texts:
Rule: When Touch is Released:
Do: Change Attribute game.FutureWeekIndex to game.FutureWeekIndex+1
Rule: If game.FutureWeekIndex = game.CurrentWeekIndex
Do: Change Attribute game.FutureWeekIndex to game.CurrentWeekIndex+1
(Similar rules apply for the others as well)

Actor 10: ConfirmButton
Rule:
When touch is released and
If tableCellValue(game.EventsSchedule, game.FutureWeekIndex, 78) = 0
Do: Change Table Value
Table: game.EventsSchedule
Row: game.FutureWeekIndex
Column: 78 Value: 1
Column: 2 Value: tableCellValue(game.Cities, game.FutureCitiesIndex, 1)
Column: 3 Value: tableCellValue(game.Venues, game.FutureVenuesIndex, 1)

Comments

  • jbguidajbguida Posts: 8Member, BASIC

    **I actually resolved this myself with a slight workaround. The "confirm" button now opens up a pause menu and then edits the table from there. That lets the previous scenes cycling functions continue to work. I think what was happening was that once "confirm" was pushed once, its rules continued to fire even when other global attributes were changed.

    Thanks for reading those who did!

  • AlchimiaStudiosAlchimiaStudios Posts: 909Member, PRO

    @jbguida said:
    **I actually resolved this myself with a slight workaround. The "confirm" button now opens up a pause menu and then edits the table from there. That lets the previous scenes cycling functions continue to work. I think what was happening was that once "confirm" was pushed once, its rules continued to fire even when other global attributes were changed.

    Thanks for reading those who did!

    glad you got it working.

    Follow us: Twitter - Website

  • tatiangtatiang Posts: 11,215Member, Sous Chef, PRO, Senior Sous-Chef

    @jbguida said:
    Thanks for reading those who did!

    I did and tables are right up my alley but it was a bit much to suggest a solution in a sentence or two. Good to hear you found a way around it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.