Skript

Skript

743k Downloads

The return effect can only be used in functions, custom expressions, sections, .... (Skript-Reflect error)

Vulcano771 opened this issue ยท 10 comments

commented

Skript/Server Version

Latest (2.8.2)

Bug Description

So when using the provided code Skript thinks there's an wait thingy in there - removing the teleport thing is removing the error.
When using Sk-Reflect it says that Im using a wait thing

Expected Behavior

No error

Steps to Reproduce

local function test(p: player) :: boolean:
    loop {_players::*}:
        teleport loop-value to {loc}
    
    return true

people on dc said its because players::* is null but that is not tested (i guess) so i tested

local function test(p: player) :: boolean:
    set {_players::*} to {_p}
    loop {_players::*}:
        teleport loop-value to {loc}
    
    return true

but same error

Errors or Screenshots

No response

Other

No response

Agreement

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

https://discord.com/channels/135877399391764480/138027100593455104/1208917960954216478

There's the context the people on discord think i'm dumb thatswhy I wrote the thing at the end, sorry

commented

error occurs too when using global vars

e.g.:

local function test(p: player) :: boolean:
    loop {players::*}:
        teleport loop-value to {loc}
    
    return true
    ```
commented

It can be fixed by:

local function tpPlayer(p: player):
    teleport {_p} to {loc}

local function test(p: player) :: boolean:
    loop {players::*}:
        tpPlayer(loop-value)
    
    return true
    ```
commented

but thats kinda not nice thatswhy I opened this bug report

commented

Please provide the proper details of your /sk info as requested in the issue report form. Also, test without any addons and let us know if that issue persists.

commented

People say I need to use non local (https://discord.com/channels/135877399391764480/138027100593455104/1208922964641325079) but same issue

function test(p: player) :: boolean:
    set {_players::*} to {_p}
    loop {_players::*}:
        teleport loop-value to {loc}
    
    return true
commented

on paperspigot, the teleport effect runs delayed and function returns can't occur after a delay. you can use force teleport loop-value to {loc} to avoid this, but do keep in mind this will cause lag if the chunk you are teleporting to needs to be loaded/generated. @Vulcano771 confirmed on discord they are running paper

commented

Yep, that fixes it, bug can be closed ^^

commented

i do it with the other function workarround

commented

Oh Pika/Ayham what is that workarround then doing? #6444 (comment)

is that then forcing or just moving it to another thread or is skript just ignoring the delay there?