Permanently saving an attribute?

NoRReyNoRRey Member, PRO Posts: 6

I'm trying to code a game, and I want an attribute to change in the code itself. For example, I could change the attribute to 1, but if I go into the code or load up the preview again, it's back to default. I need a way to change it in the code, specifically for a table.

I'm using a table, trying to code a rhythm game, and I've already made a charter, but it's worth nothing if the notes are gone after a game refresh.

Comments

  • ArmellineArmelline Member, PRO Posts: 5,479

    You can't directly. But you can output the results of whatever you do in-game to change the table to the debugger (or an email, or an online table with more effort) and re-import it back into the table editor.

    I did this for a game where I created a level editor and made the levels using that. I'd create the level in the level editor, send the table to the debugger as CSV, then import that level into a table in the actual game.

    Ability to view and export tables at runtime would definitely be a very valuable addition to Creator 2, though, if @adent42 is reading this :D

  • NoRReyNoRRey Member, PRO Posts: 6


    How would I save that table as a CSV? I assume importing the CSV is as simple as dragging and dropping, but I can't find any behaviors that give you a file.

  • ArmellineArmelline Member, PRO Posts: 5,479

    You can't export it directly, but the formatting of CSV files are very simple so can be easily assembled and dumped into the debugger.

    You just loop over the table, merge the values, dump it into an attribute and then send that attribute to the debugger. Attached is a very quickly made, very crude project that does exactly that.

    Copy the text from the debugger and paste it into a plain text file and save it as CSV and boom you have a CSV.

    You can also export the table structure with column titles and formats to CSV and copy those top two lines and add them to the top of the CSV you made to get the "full" table, but that's not really necessary.


  • NoRReyNoRRey Member, PRO Posts: 6

    Sorry for the questions, but I also don't know how how I would merge the values. I'm trying to get it to loop over the table and put the values somewhere, but I just don't know to get it to work. It's just giving me 12 every time.

  • ArmellineArmelline Member, PRO Posts: 5,479

    I always just merged them like in the demo project I provided - using tableMergeValues. Happy to take a quick look at your specific project if you want, just don't attach it here in the forums!

  • NoRReyNoRRey Member, PRO Posts: 6

    I actually got it to work! the way I have the charter work is to have a timer and reset it when I press a note so I can chart the song by playing it. Though, it seems gamesalad can't go fast enough for this to work at all :/ it just returns zeros

  • ArmellineArmelline Member, PRO Posts: 5,479

    If the data is ending up in a table, it's definitely possible to extra that data from the table. How are you storing the song as you play it?

  • NoRReyNoRRey Member, PRO Posts: 6

    I have a timer that ticks until I presses a button, and when I press it, it stores the timer's value and the button I pressed. However, gamesalad's loops/timers can't be precise/fast enough to return anything but a zero when I hit two buttons close together.

  • ArmellineArmelline Member, PRO Posts: 5,479

    That should definitely be possible for GameSalad to handle, the only question is how precise you need it to be. If it's storing zeros, that's a logic error somewhere.

  • NoRReyNoRRey Member, PRO Posts: 6

    It was a logic error. It was logging zeroes because it kept storing the value in the first slot. Thanks for the help but it works perfect now

Sign In or Register to comment.