brownlee219
Member
The code below works great on my PC but on my Mac it creates this error:
Unable to find any instance for object index '0' name 'obj_bridge'
at gml_Script_scr_sort_list (line 18) - while (ds_list_find_value(global.control_group_none, j).list_priority < list_priority)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_sort_list (line 18)
called from - gml_Script_scr_select_units (line 294) - scr_sort_list()
called from - gml_Object_obj_controller_Step_0 (line 29) - scr_select_units()
Here's the code:
// scr_sort_list()
// this script will sort the unit each time it gets added to a ds list
// if the unit has a higher list_priority it will be sorted closer
// to the front of the list
var j = 0
// if list_priority of the first unit is less than the current unit's priority
// then insert the current unit at the beginning of the list
// set j to equal the last unit in the list
j = ds_list_size(global.control_group_none) - 1
// this script will start at the end of the list and loop through to the front
// to place the unit where it belongs
if ds_list_size(global.control_group_none) > 0
{
while (ds_list_find_value(global.control_group_none, j).list_priority < list_priority)
{
j -=1
if j = -1
break
}
// insert the unit into the list
if ds_list_find_index(global.control_group_none, id) = -1
ds_list_insert(global.control_group_none, j+1, id)
}
else if ds_list_find_index(global.control_group_none, id) = -1
ds_list_add(global.control_group_none, id)
Anyone know what causing this error? Thanks!
Unable to find any instance for object index '0' name 'obj_bridge'
at gml_Script_scr_sort_list (line 18) - while (ds_list_find_value(global.control_group_none, j).list_priority < list_priority)
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_sort_list (line 18)
called from - gml_Script_scr_select_units (line 294) - scr_sort_list()
called from - gml_Object_obj_controller_Step_0 (line 29) - scr_select_units()
Here's the code:
// scr_sort_list()
// this script will sort the unit each time it gets added to a ds list
// if the unit has a higher list_priority it will be sorted closer
// to the front of the list
var j = 0
// if list_priority of the first unit is less than the current unit's priority
// then insert the current unit at the beginning of the list
// set j to equal the last unit in the list
j = ds_list_size(global.control_group_none) - 1
// this script will start at the end of the list and loop through to the front
// to place the unit where it belongs
if ds_list_size(global.control_group_none) > 0
{
while (ds_list_find_value(global.control_group_none, j).list_priority < list_priority)
{
j -=1
if j = -1
break
}
// insert the unit into the list
if ds_list_find_index(global.control_group_none, id) = -1
ds_list_insert(global.control_group_none, j+1, id)
}
else if ds_list_find_index(global.control_group_none, id) = -1
ds_list_add(global.control_group_none, id)
Anyone know what causing this error? Thanks!