P
Philip Wee
Guest
Hey guys facing a pretty stupid problem, sorry im quite new to gamemaker
So my code works when it is in my step event:
but when i copied and pasted it into scr_create_prox_menu, and replaced all the obj_proximity_test with argument0 and all the prox_MENU with argument1, and put it back into my step event as the script it stopped working! ARGH
MAIN PROBLEM:
So after running it through the debugger, I realised that prox_MENU[0] was not being set to true when i swapped it out with argument0[0] = true and ran the script. Any idea how to fix that?
Script code:
(Also i know its kinda of stupid to make an array into a ds script and then make it into an array AGAIN but at least that i know how to fix)
So my code works when it is in my step event:
but when i copied and pasted it into scr_create_prox_menu, and replaced all the obj_proximity_test with argument0 and all the prox_MENU with argument1, and put it back into my step event as the script it stopped working! ARGH
MAIN PROBLEM:
So after running it through the debugger, I realised that prox_MENU[0] was not being set to true when i swapped it out with argument0[0] = true and ran the script. Any idea how to fix that?
Code:
if (place_meeting(x,y,obj_proximity_test) = true && prox_MENU[0] = false)
{
prox_MENU[0] = true
for(i = 1; i < array_length_1d(prox_MENU); i += 1)
{
ds_list_add(EXPANDABLELIST,prox_MENU[i])
}
for(i = 0; i < ds_list_size(EXPANDABLELIST); i += 1)
{
EXPANDABLEMENU[i] = ds_list_find_value(EXPANDABLELIST,i)
}
scr_truncate_menu(EXPANDABLEMENU)
show_debug_message(string(EXPANDABLEMENU))
}
if (place_meeting(x,y,obj_proximity_test) = false && prox_MENU[0] = true)
{
prox_MENU[0] = false
for(i = 1; i < array_length_1d(prox_MENU); i += 1)
{
ds_list_delete(EXPANDABLELIST,ds_list_find_index(EXPANDABLELIST,prox_MENU[i]))
}
EXPANDABLEMENU = [];
for(i = 0; i < ds_list_size(EXPANDABLELIST); i += 1)
{
EXPANDABLEMENU[i] = ds_list_find_value(EXPANDABLELIST,i)
}
scr_truncate_menu(EXPANDABLEMENU)
show_debug_message(string(EXPANDABLEMENU))
show_debug_message("uncolided")
}
Script code:
Code:
if (place_meeting(x,y,argument0) = true && argument1[0] = false)
{
argument1[0] = true
for(i = 1; i < array_length_1d(argument1); i += 1)
{
ds_list_add(EXPANDABLELIST,argument1[i])
}
for(i = 0; i < ds_list_size(EXPANDABLELIST); i += 1)
{
EXPANDABLEMENU[i] = ds_list_find_value(EXPANDABLELIST,i)
}
scr_truncate_menu(EXPANDABLEMENU)
show_debug_message(string(EXPANDABLEMENU))
}
if (place_meeting(x,y,argument0) = false && argument1[0] = true)
{
argument1[0] = false
for(i = 1; i < array_length_1d(argument1); i += 1)
{
ds_list_delete(EXPANDABLELIST,ds_list_find_index(EXPANDABLELIST,argument1[i]))
}
EXPANDABLEMENU = [];
for(i = 0; i < ds_list_size(EXPANDABLELIST); i += 1)
{
EXPANDABLEMENU[i] = ds_list_find_value(EXPANDABLELIST,i)
}
scr_truncate_menu(EXPANDABLEMENU)
show_debug_message(string(EXPANDABLEMENU))
show_debug_message("uncolided")
}
(Also i know its kinda of stupid to make an array into a ds script and then make it into an array AGAIN but at least that i know how to fix)