Skip to content

Custom effect add %objects% to [form] %object% shadows Skript's built-in add ... to ... (optional [form] makes the pattern too greedy) #15

Description

@Im-Tim-mI

Summary

The custom effect defined at line 248 of ApiFloodgate.sk intercepts Skript's
built-in add ... to ... effect, breaking arithmetic and list additions
across the entire server.

Affected code

ApiFloodgate.sk, line 248:

effect add %objects% to [form] %object%:

Because [form] is optional, the pattern also matches the plain shape
add %objects% to %object%, which is identical to the built-in
add ... to ... effect. As a result, statements like add 1 to {_i}
get parsed as THIS custom effect instead of the built-in one. The trigger
then runs its form-building logic (split by "[;;]", dropdown/button checks,
etc.), none of which applies, and the target variable is left unchanged.

Minimal reproduction

With ApiFloodgate.sk loaded:

command /addbug:
    trigger:
        set {_i} to 1
        add 1 to {_i}
        send "add result: %{_i}%"          # prints 1, expected 2
        set {_x} to 1
        set {_x} to {_x} + 1
        send "plus result: %{_x}%"          # prints 2 (correct)

add 1 to {_i} does not increment, while set {_x} to {_x} + 1 works,
confirming the built-in add effect is being shadowed.

Impact

Server-wide. Every add X to {variable} in every script silently does
nothing useful once this file is loaded — both numeric counters and list
appends are affected. No error is shown, which makes it very hard to trace.

Suggested fix

Make the form keyword required so the pattern no longer collides with the
built-in effect:

effect add %objects% to form %object%:

(Note: this requires callers to write add ... to form {_form} instead of
add ... to {_form}.)

Workaround (for users)

Use set {var} to {var} + 1 for counters, or write component additions as
add ... to form {_form} after applying the fix above.

Environment

  • Skript + Skript-Reflect + Floodgate (as listed in the file header)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions