TheNegroShoddy
Member
I'm trying to draw to the screen a list of the cards in the player's inventory and then beside the card name should be the amount of each individual card the player owns. When I run the code below I only see the names of the cards in the player's inventory and not the number of each card they own. The inventory_ list handles the list of cards the player owns, while the global.inventory list handles the amount of each card the player owns.
EDIT: I realized what I did wrong. Should have just checked to see if cv and ce is equal to the card instead of ds_find_value (global.inventory, whatever card).
Code:
// ====== Draw card inventory to screen
// Display all cards from the inventory list. This list shouldn't display any duplicate names
if !ds_list_empty(global.inventory_list)
{
for (n = 0; n < ds_list_size(global.inventory_list); n++)
{
draw_text(736, yy, string(ds_list_find_value(global.inventory_list, n)) ); // (Displays all the cards owned in the players inventory)
var ce = ds_list_find_value(global.inventory_list, n)
if ce = ds_map_find_value( global.inventory, "Snipe Shot")
{
draw_text(850, yy, string( ds_map_find_value( global.inventory, "Snipe Shot"))); // Should display the number of snipe shot cards the player owns
}
var cv = ds_list_find_value(global.inventory_list, n)
if cv = ds_map_find_value( global.inventory, "Barrier")
{
draw_text(850, yy, string( ds_map_find_value( global.inventory, "Barrier"))); // Should display the number of barrier cards the player owns
}
yy+=20;
}
}
yy = y; // Must have this to prevent text from flying off screen
EDIT: I realized what I did wrong. Should have just checked to see if cv and ce is equal to the card instead of ds_find_value (global.inventory, whatever card).
Last edited: