Energy Engine
Member
I'm trying to combine lists, arrays and scripts with arguments into one cohesive system.
Thanks to valuable help I received in this topic, the list and scripts worked. But I've realized now that arguments will apparently be needed. I couldn't properly understand the solution for how arguments could be added to scripts in lists, and arrays were suggested as an alternative. Currently I'm having two issues:
1) Getting the script inside the list, with arrays as arguments, to be read correctly
2) Getting a draw text function that can show all types of data. The problem here is with scripts showing as numbers instead of the script resource name.
Here's what I have:
create:
step (issue 1):
When I press the key, it gives me the following error:
The draw code seems to be working fine, but the only problem (issue 2) is getting the script name to show. I can see a number which I assume is the script itself, along with the "message works" text and the 999 figure. I know I can use "script_get_name" separately, but am wondering if its actually possible to maybe squeeze in that along with "string" to form a single piece of code. My current draw code:
Any guidance would again be greatly appreciated.
Many thanks!
Thanks to valuable help I received in this topic, the list and scripts worked. But I've realized now that arguments will apparently be needed. I couldn't properly understand the solution for how arguments could be added to scripts in lists, and arrays were suggested as an alternative. Currently I'm having two issues:
1) Getting the script inside the list, with arrays as arguments, to be read correctly
2) Getting a draw text function that can show all types of data. The problem here is with scripts showing as numbers instead of the script resource name.
Here's what I have:
create:
Code:
list = ds_list_create();
array[0] = scr_debug_msg ///the script
array[1] = "message works" //argument0 for show_debug_message function
array[2] = 999 //argument1 for the another show_debug_message
ds_list_add(list, array);
Code:
if keyboard_check_pressed(220)
{
if ds_exists(list,ds_type_list)
{
for(var i=0; i<ds_list_size(list); i++)
{
script_execute(ds_list_find_value(list,array[@ i]));
}
}
}
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object oai_new:
(null) argument 1 incorrect type (undefined) expecting a Number (YYGI32)
at gml_Object_oai_new_Step_0 (line 20) - script_execute(ds_list_find_value(list,array[@ i]));
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oai_new_Step_0 (line 20)
Code:
if ds_exists(list,ds_type_list)
{
for(var i=0; i<ds_list_size(list); i++){
draw_text(1205, 105 + (24*i), string(list[| i]));
}
Many thanks!
Last edited: