C
Cooltrain
Guest
Hey all,
So I've got a script that needs to accept either two, or three arguments. The current problem being that by setting it to its maximum of 3 it always requires 3. I'm trying to use the argument count/array for having between 2 or 3, but I'm not sure I'm using it correctly.
This is a section of the step event in the object that calls the script. These variables are going to be sent to the script
obj_textController step
Further down when ready we send the vars to the script
This is the top of the receiving script
So as said above, some times i might only use the first two arguments which leaves textList[pos, 2] blank throwing an exception because its still expecting three arguments.
Thanks for any help.
So I've got a script that needs to accept either two, or three arguments. The current problem being that by setting it to its maximum of 3 it always requires 3. I'm trying to use the argument count/array for having between 2 or 3, but I'm not sure I'm using it correctly.
This is a section of the step event in the object that calls the script. These variables are going to be sent to the script
obj_textController step
Code:
pos = array_height_2d(textList); //size of array
textList[pos, 0] = section[0] //line1
textList[pos, 1] = section[1] //line2
textList[pos, 2] = section[2] //line3
Code:
pos = array_height_2d(textList);
for (i = 0; i < pos; i += 1) {
scr_textInput(textList[i, 0], textList[i, 1],textList[i, 2]);
}
This is the top of the receiving script
Code:
if(argument_count<=2){
///scr_textInput(value0,value1,value2)
var arg0 = argument[0];
var arg1 = argument[1];
}else{
var arg0 = argument[0];
var arg1 = argument[1];
var arg2 = argument[2];
}
Thanks for any help.