• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Needed some basic help with Arrays for a save system

K

KranoNetwork

Guest
I am working on a program which would create a character sheet for a table top system. One of the parts I am working on is an array system which would allow me to set an infinite number of save spaces. Currently I have a menu system which brings me to two pages, one of the pages would edit a global variable called "global.saves" and create a new sheet, the other uses an array that would continue adding menu buttons every time a global.saves was increased by 1. The idea being to limit limitations with the software to make it so that you could create as many sheets as you wish. Here is my code so far, and the results.


// Create the Menu
menu_x = x;
menu_y = y;
button_h = 64;

// buttons
var i
i = global.saves
button[i] = "save";
buttons = array_length_1d(button);



menu_index = 0;
last_selected = 0;



Global Saves was automatically set to 4 for testing, the result is this:

idealy, I want the software to be able to create a global variables which would print the name of the character (Cname#) and a value for the system (system#) and it would print text assign to the variables, with the #s being increased infinitely.

Would anybody know how to help me with this?
 

Attachments

sp202

Member
Not sure I understand what the issue is, I assume you're using a for loop to draw those values, you'd do the same for the variables, assuming you've got them saved in an array.
 
K

KranoNetwork

Guest
Not sure I understand what the issue is, I assume you're using a for loop to draw those values, you'd do the same for the variables, assuming you've got them saved in an array.
I fixed the issue, basically what I was doing wrong was I needed a repeat function. Here is the function


var i;

a = global.saves;

b = a - 1

i = b;

repeat(a)
{
button[i] = "save";
i -= 1;
}


Now I am attempting to learn if there is a command to create variables. Like if I want to create the variable via actions like one called name1 which could go on to something like name23. Do you know if that is possible?
 
Top