S
shnizl
Guest
Heya
Is it not possible to use a script with passing arguments in layer_script_begin()?
I am trying to use a shader that constantly increases the alpha value of a tile layer, then decreasing, increasing and so on. In my Objects Create Event i assigned a variable _time that changes in a step event and sets the alpha value with _speed as a uniform variable in the shader. Those are used in the the script scr_shd_alpha_begin() within layer_script_begin. Looks like this:
// Create Event
_time = 0;
_speed = 1.0;
var lay_id = layer_get_id("Wand_Lava");
layer_script_begin(lay_id, scr_shd_alpha_begin(_time, _speed));
layer_script_end(lay_id, scr_shd_alpha_end);
// Script scr_shd_alpha_begin
var _time = argument0;
var _speed = argument1;
if event_type == ev_draw
{
if event_number == 0
{
_uniTime = shader_get_uniform(shd_alpha, "u_time");
_uniSpeed = shader_get_uniform(shd_alpha, "u_speed");
shader_set(shd_alpha);
shader_set_uniform_f(_uniTime, _time);
shader_set_uniform_f(_uniSpeed, _speed);
}
}
When i run it i get this Error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_camera_matrix:
illegal access of argument, argument is not provided to script
at gml_Script_tile_collide_at_points (line 3) - var tile_map_id = argument[0];
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_tile_collide_at_points (line 3)
object obj_camera_matrix is unused and all its code is marked as comments. gml_Script_tile_collide_at_points is from a tutorial, has no correlation to the other script and actually works fine. The shader works on other objects and tiles and the script also works if i dont transmit arguments but define variables in it. But then i don't see how to change them constantly as i do in the step event.
I am really getting desperate here If you have any suggestions it'd make my day.
Is it not possible to use a script with passing arguments in layer_script_begin()?
I am trying to use a shader that constantly increases the alpha value of a tile layer, then decreasing, increasing and so on. In my Objects Create Event i assigned a variable _time that changes in a step event and sets the alpha value with _speed as a uniform variable in the shader. Those are used in the the script scr_shd_alpha_begin() within layer_script_begin. Looks like this:
// Create Event
_time = 0;
_speed = 1.0;
var lay_id = layer_get_id("Wand_Lava");
layer_script_begin(lay_id, scr_shd_alpha_begin(_time, _speed));
layer_script_end(lay_id, scr_shd_alpha_end);
// Script scr_shd_alpha_begin
var _time = argument0;
var _speed = argument1;
if event_type == ev_draw
{
if event_number == 0
{
_uniTime = shader_get_uniform(shd_alpha, "u_time");
_uniSpeed = shader_get_uniform(shd_alpha, "u_speed");
shader_set(shd_alpha);
shader_set_uniform_f(_uniTime, _time);
shader_set_uniform_f(_uniSpeed, _speed);
}
}
When i run it i get this Error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Draw Event
for object obj_camera_matrix:
illegal access of argument, argument is not provided to script
at gml_Script_tile_collide_at_points (line 3) - var tile_map_id = argument[0];
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_tile_collide_at_points (line 3)
object obj_camera_matrix is unused and all its code is marked as comments. gml_Script_tile_collide_at_points is from a tutorial, has no correlation to the other script and actually works fine. The shader works on other objects and tiles and the script also works if i dont transmit arguments but define variables in it. But then i don't see how to change them constantly as i do in the step event.
I am really getting desperate here If you have any suggestions it'd make my day.