Problems w/ Arguments and Arrays... and Alliteration :D

Zerb Games

Member
Hey Guys! I'm porting a inventory engine I made in GM:8 I already ported a project that I made similar to it so I kinda figured out how to deal with pesky changes like the execute_string, and variable_local_exists and other obsolete functions

This engine worked in fine in GM8, but I'm having problems with a recurrent theme in this project. I used a lot of scripts using arrays, and obviously arguments to set init my variables. So here's the first script to come up giving me an error:
skill[argument[0],9] = argument[1] - (argument_count<=1); //end cast script
skill[argument[0],10] = argument[2] - (argument_count<=2); //begin cast script
skill[argument[0],11] = argument[3] - (argument_count<=3); //while cast script

And I'm accessing it like this in my create event:
skillSetScriptEffects(skillEffect,scrEffectCast,scrEffectBegin);

scrEffectCast and scrEffectBegin are both empty and a template...

And it's giving me this error:
illegal access of argument, argument is not provided to script
at gml_Script_skillSetScriptEffects (line 20) - skill[argument[0],11] = argument[3] - (argument_count<=3); //while cast script
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_skillSetScriptEffects (line 20)
called from - gml_Object_oSkillBar_CreateEvent_2 (line 34) - skillSetScriptEffects(skillEffect,scrEffectCast,scrEffectBegin);

I have a big block of unused /*"Stuff"*/ in the script so it says line 20.

Thanks m8s.
 

Phil Strahl

Member
As I see it, you are passing three arguments to your script, but in line
Code:
skill[argument[0],11] = argument[3] - (argument_count<=3); //while cast script
it expects a fourth argument ("argument[3]")
 

jazzzar

Member
As I see it, you are passing three arguments to your script, but in line
Code:
skill[argument[0],11] = argument[3] - (argument_count<=3); //while cast script
it expects a fourth argument ("argument[3]")
that's right, wrong number of arguments, arguments start at 0 so from 0 to 3 there is 4 arguments, you only provided 3
 
Top