Am I missing something really obvious? Because I don't understand why this is not working.
The problem is at the very end of the function but I thought I would paste everything just in case.
func create_Item_Grid_tag(item_data):
print("\n :create_Item_Grid_tag:")
var item_name :String = item_data[0]
var item_anim :int = item_data[1]
var item_button :Object = button_scn.instance()
var item_object :Object = item_button.get_node("Item")
item_object.frame = item_anim
item_button.name = item_name
Item_Grid.rect_scale = Vector2(0.5,0.5)
Item_Grid.add_child(item_button)
#Item has no recipe
if item_data[7] == null:
return
#Item has recipe
for material in item_data[7]["recipe"]:
var total_amount :int = WL.WList_mats[material]
var inv_loop :bool = false
var dict_amount :Dictionary
#If Material Tag exist
if Mat_Grid.has_node(material):
update_Mat_Grid(material,total_amount,null)
#If Material Tag doesn't exist
else:
var inv_amount:int
if !inv_loop:
dict_amount = get_Mat_Grid_inv_amount([item_data[7]["recipe"].keys()])
inv_amount = dict_amount[material]
inv_loop = true
if inv_loop:
print("inv_loop Triggered")
inv_amount = dict_amount[material]
create_Mat_Grid_tag(material,total_amount,inv_amount)
at:
if !inv_loop:
if inv_loop:
if if inv_loop
is an else
or even an elif inv_loop
it won't go inside that statement and call create_Mat_Grid_tag()
my whole idea was to get an array with all the recipe ingredients and search for all of them in the same inventory loop instead of looping thought the inventory multiple times but searching different ingredients. And then this happened. It works as intended with the if statement but I would like to know why the others don't work in this case.