Skip to content

Function Already Exists With Same Argument Types False Error #8029

@aaaeeeMC

Description

@aaaeeeMC

Skript/Server Version

[14:34:44 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[14:34:44 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[14:34:44 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[14:34:44 INFO]: [Skript] Server Version: 1.21.4-114-cd9d6d6 (MC: 1.21.4)
[14:34:44 INFO]: [Skript] Skript Version: 2.12.0-pre2 (skriptlang-github)
[14:34:44 INFO]: [Skript] Installed Skript Addons:
[14:34:44 INFO]: [Skript]  - SkBee v3.11.3 (https://github.com/ShaneBeee/SkBee)
[14:34:44 INFO]: [Skript] Installed dependencies: None

Bug Description

There is a bug happening when I try to reload a script file with functions in it, and it's just so annoying. I am certain it's a bug because it's a false error, the functions are NOT repeated with the same arguments! They're only written once.

Expected Behavior

The scripts are supposed to reload without errors, of course. I don't think I've ever had something unique to say in the Expected Behavior category.

Steps to Reproduce

Note that you might not assuredly be able to reproduce this. This is because I made another localhost server with only Skript installed, and I tried replicating the same folder structure for the enemies folder below, and I made a skript file in each of the folders with a function in them each, and there were no errors when I reloaded them. So I'll try to give a lot of info.

The entire folder structure is:

scripts
    functions.sk
    fillstick.sk
    worlds.sk
    items
        global.sk
    players
        enemies_spawn.sk
        functions.sk
        music_and_buttons.sk
    enemies
        global.sk
        bosses
        minibosses
        mob
            sandburster.sk
            spider.sk
            skeleton.sk
            zombie.sk

When I reload the scripts, this happens:

[14:39:55 INFO]: [Skript] Reloading all scripts...
[14:39:55 INFO]: Line 24: (enemies\global.sk)
[14:39:55 INFO]:     Function 'setHealthBarInName' with the same argument types already exists.
[14:39:55 INFO]:     Line: function setHealthBarInName(e: entity, hp: number):
[14:39:55 INFO]:
[14:39:55 INFO]: Line 29: (enemies\global.sk)
[14:39:55 INFO]:     Function 'cleanseOfVehicle' with the same argument types already exists.
[14:39:55 INFO]:     Line: function cleanseOfVehicle(s: entity):
[14:39:55 INFO]:
[14:39:55 INFO]: Line 41: (enemies\global.sk)
[14:39:55 INFO]:     Function 'drop' with the same argument types already exists.
[14:39:55 INFO]:     Line: function drop(i: item, v: entity):
[14:39:55 INFO]:
[14:39:56 INFO]:     Encountered 3 errors while reloading all scripts! (1295ms)

Not only when reloading all the scripts, but also when reloading that script file alone.

Here's what's in that script file:

on damage of mob:
    hastag("enemy", victim) = true
    attacker is a player
    cancel event
    invulnerability time of victim = 0 seconds
    set invulnerability time of victim to 7 ticks
    play hurt animation on victim

    set {_damage} to (int tag "damage" of custom nbt of attacker's tool) otherwise 1
    set {_defense} to getnbt("int", "defense", victim) otherwise 0
    set {_hp} to getnbt("int", "hp", victim)
    set {_newhp} to {_hp} - dmgval(({_damage} * (attack cooldown of attacker)) - {_defense})
    set {_loss} to {_hp} - {_newhp}
    setnbt("int", "hp", {_newhp}, victim)

    if {_newhp} <= 0:
        hastag("boss", victim) = false
        set victim's name to rep("&8|", 30)
        kill victim
    else:
        play sound (victim's hurt sound) with pitch rand(0.9, 1.1) at victim
        setHealthBarInName(victim, getnbt("int", "max_hp", victim))

function setHealthBarInName(e: entity, hp: number): # !!!!
    set {_greenTimes} to clamp(floor((getnbt("int", "hp", {_e}) / {_hp}) * 30), 1, 30)
    set {_grayTimes} to floor(30 - {_greenTimes})
    set {_e}'s name to "%rep("&a|", {_greenTimes})%%rep("&8|", {_grayTimes})%" # rep(s: string, times: integer) repeats a string a given number of times, or empty string if 0

function cleanseOfVehicle(s: entity): # !!!!
    {_s}'s vehicle is set
    set {_v} to {_s}'s vehicle

    force {_s} to dismount from their vehicle
    killTotal({_v}) # irrelevant

local function dmgval(n: integer) :: integer:
    if {_n} < 1:
        return 1
    return {_n}

function drop(i: item, v: entity): # !!!!
    drop {_i} 0.25 above {_v} without velocity

I don't consider this to be a random occurrence, as it happens everytime I join my server. Just what the skript is going on? I hope all this information proves useful and the problem gets fixed. If you need to know more, then ask.

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue that needs to be fixed. Alternatively, a PR fixing an issue.waiting for replyThe report needs a response from the reporter to determine course of action.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions