Issue with a script?

C

corwin22

Guest
I am trying to make it so that I use a script to call a block with custom commands using this script
/// Scr_CustomBlock("Create","Step")
instance_create_layer(64,64,"Funtions",obj_CustomBlock)

global.CustomCreate = argument0;
global.CustomStep = argument1;
and the object uses this

string_letters(global.CustomStep)
inside the step event

I type
Scr_CustomBlock((undefined),("if (keyboard_check(vk_space)) {game_end()}"))
and it doesn't do anythng when i press space?
 
It seems to me what you're trying to do is execute code from a string. There was a function in old, pre-Studio versions of GameMaker that did this, but it is now obsolete. There is no way to do this currently.
 

GMWolf

aka fel666
String letters will just give you another string.

It will not run any other code.

If you want to run custom code like that, you need to write something to read, and interpret that string.
 
C

corwin22

Guest
I am trying to make it so i can use a script to summon a obj that has the text in the command in a step event so i can have 1 custom object instead of many for different senarios
 

GMWolf

aka fel666
I am trying to make it so i can use a script to summon a obj that has the text in the command in a step event so i can have 1 custom object instead of many for different senarios
there is a better way:

Instead of writing you code in a string, create a script.
Then, when you create your object, give it that script.
in the object, you can run that script using script_execute.

I have made a video tutorial about just this:
 
Top