Gamerev147
Member
I am trying to load information saved for a button.
In the instance creation code in the room editor, this button is given an ID (var idd). This variable is not defined in the create event.
Could someone please tell me why this code does not work at all?
The problem is that no information is loaded. The text on the button doesn't change. Nothing works. Any help is appreciated! Thanks.
EDIT: The information is saved perfectly fine. It saves with the correct name and everything. It's just that nothing loads.
In the instance creation code in the room editor, this button is given an ID (var idd). This variable is not defined in the create event.
Could someone please tell me why this code does not work at all?
Code:
///@description Local Variables
item = "";
price = 0;
catagory = "";
permissions = 0;
draw = false;
alarm[0] = 5;
Code:
if (file_exists(string(idd) + ".ini")) {
ini_open(string(idd) + ".ini");
item = ini_read_string(string(item), "item", "");
price = ini_read_string(string(item), "price", "");
catagory = ini_read_string(string(item), "catagory", "");
permissions = ini_read_string(string(item), "permissions", "");
ini_close();
}
if (item != "") {
draw = true;
}
Code:
///@description Save Information
ini_open(string(idd) + ".ini");
ini_write_string(string(item), "item", string(item));
ini_write_string(string(item), "price", string(price));
ini_write_string(string(item), "catagory", string(catagory));
ini_write_string(string(item), "permissions", string(permissions));
ini_close();
Code:
draw_self();
draw_set_font(fnt_Main);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
if (draw = true) {
draw_set_color(c_white);
draw_text(x, y - 4, string(item));
draw_text(x, y + 14, string(price));
}
Code:
if (item = "") {
show_message("This template is empty. Press OK to create a new item.");
item = get_string("Item: ", "");
price = get_string("Price: ", "");
catagory = get_string("Catagory: ", "");
permissions = get_string("Permissions: ", "");
alarm[1] = 3;
} else {
ds_list_add(global.list, string(item), string(price));
global.subtotal += real(price);
}
The problem is that no information is loaded. The text on the button doesn't change. Nothing works. Any help is appreciated! Thanks.
EDIT: The information is saved perfectly fine. It saves with the correct name and everything. It's just that nothing loads.