• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Arguments aren't shown in the Constructor Function

Petrik33

Member
I don't know if it should be this way, but if it does than it's just really bad and disgusting. I've tried to develop attacks for AI mobs in my game using new Structs, and this is the code I've ended up with(please let me know if there are any other problems except for the one I will explain below the code):
GML:
#region//Parent Attack

#region//Description
///@func Attack
///@arg inst
///@arg sprite
///@arg time*
///@arg cooldown(sec)
///@arg speed(1)
///@arg target(inst)
///@arg x_range
#endregion

function Attack(_inst,_sprite,_attack_time,_attack_cooldown,_attack_speed,_attack_target,_attack_x_range) constructor
{
    attack_owner = _inst;
    attack_sprite = _sprite;
    attack_cooldown_time = _attack_cooldown * FRAME_RATE;
    attack_target = _attack_target;
    if(_attack_time!=noone && _attack_time!=-1)
    {
        AnimationSetLength(_sprite,_attack_time);
    }
    attack_speed = _attack_speed;
    attack_cooldown = 0;
    attack_cooldown_check = function(){
        
        attack_cooldown+=attack_speed;
        return     attack_cooldown>=attack_cooldown_time
        
    }
}

#endregion

//Dash Attack Function
//...
//...
Then I've made the Child Function of that function to then apply this to the object in the game, I thought this would make the proccess of applying AI behaviour to the objects easier because they don't inherit the neccesarry variables from just the objects. But I've met the critical problem which made this proccess even impossible to test: When I write new Attack(...)
I just don't get the arguments names in the bottom (I've attached the screenshot showing this) , like I don't know what argument to enter even though I've made the function JSDoc description which usually works perfectly with normal functions. So what have I done wrong???
 

Attachments

drandula

Member
Try "/// @func Attack(inst, sprite, time, cooldown, speed, target, x_range);"
I think "/// @func Attack" without any parenthesis is causing the problem.
Also for argument type suggestion I think you need to use "/// @arg {type} argument_name" style.
 

Petrik33

Member
Try "/// @func Attack(inst, sprite, time, cooldown, speed, target, x_range);"
I think "/// @func Attack" without any parenthesis is causing the problem.
Also for argument type suggestion I think you need to use "/// @arg {type} argument_name" style.
Let me try it Right Now, hope it helps...
 

Petrik33

Member
Try "/// @func Attack(inst, sprite, time, cooldown, speed, target, x_range);"
I think "/// @func Attack" without any parenthesis is causing the problem.
Also for argument type suggestion I think you need to use "/// @arg {type} argument_name" style.
It haven't helped, I have applied both what you and @FoxyOfJungle told me, reloaded the project but it didn't help, one thing I've noticed is that you may still be right because of this: See, Attack is shown without parenthesis here too
 

Attachments

FoxyOfJungle

Kazan Games
GML:
///@func Attack(inst, sprite, time, cooldown, speed, target, x_range)
///@arg inst
///@arg sprite
///@arg time*
///@arg cooldown
///@arg speed
///@arg target
///@arg x_range


function Attack(_inst,_sprite,_attack_time,_attack_cooldown,_attack_speed,_attack_target,_attack_x_range) constructor
{
    attack_owner = _inst;
    attack_sprite = _sprite;
    attack_cooldown_time = _attack_cooldown * FRAME_RATE;
    attack_target = _attack_target;
    if(_attack_time!=noone && _attack_time!=-1)
    {
        AnimationSetLength(_sprite,_attack_time);
    }
    attack_speed = _attack_speed;
    attack_cooldown = 0;
    attack_cooldown_check = function(){
      
        attack_cooldown+=attack_speed;
        return     attack_cooldown>=attack_cooldown_time
      
    }
}

Result:

 

Petrik33

Member
GML:
///@func Attack(inst, sprite, time, cooldown, speed, target, x_range)
///@arg inst
///@arg sprite
///@arg time*
///@arg cooldown
///@arg speed
///@arg target
///@arg x_range


function Attack(_inst,_sprite,_attack_time,_attack_cooldown,_attack_speed,_attack_target,_attack_x_range) constructor
{
    attack_owner = _inst;
    attack_sprite = _sprite;
    attack_cooldown_time = _attack_cooldown * FRAME_RATE;
    attack_target = _attack_target;
    if(_attack_time!=noone && _attack_time!=-1)
    {
        AnimationSetLength(_sprite,_attack_time);
    }
    attack_speed = _attack_speed;
    attack_cooldown = 0;
    attack_cooldown_check = function(){
     
        attack_cooldown+=attack_speed;
        return     attack_cooldown>=attack_cooldown_time
     
    }
}

Result:

Probably that is the classical problem of the functions Updating, I will try creating new script with the same code
 

Petrik33

Member
GML:
///@func Attack(inst, sprite, time, cooldown, speed, target, x_range)
///@arg inst
///@arg sprite
///@arg time*
///@arg cooldown
///@arg speed
///@arg target
///@arg x_range


function Attack(_inst,_sprite,_attack_time,_attack_cooldown,_attack_speed,_attack_target,_attack_x_range) constructor
{
    attack_owner = _inst;
    attack_sprite = _sprite;
    attack_cooldown_time = _attack_cooldown * FRAME_RATE;
    attack_target = _attack_target;
    if(_attack_time!=noone && _attack_time!=-1)
    {
        AnimationSetLength(_sprite,_attack_time);
    }
    attack_speed = _attack_speed;
    attack_cooldown = 0;
    attack_cooldown_check = function(){
    
        attack_cooldown+=attack_speed;
        return     attack_cooldown>=attack_cooldown_time
    
    }
}

Result:

As I have said, it was just the GMS to upodate the descriptions, always had troubles with that, after cleaning all and pasting back in new script it worked, thank you very much!
Edit: though, I have the same problem with the child constructor, but I guess now it's fully my problem and I have to fix it myself.
 
Last edited:
Top