Skript: Waiting a local variable amount of time waits indefinitely

Created on 19 Jul 2018  路  9Comments  路  Source: SkriptLang/Skript

Version: Hotfix 2.2-dev37c

I apologize for not being specific about the errors before
I shall be as specific as possible this time.

  1. parsed timespan just waits indefinitely
command /testTimer:
    trigger:
        set {_time} to "2 seconds" parsed as timespan
        broadcast "waiting"
        wait {_time}
        broadcast "waited"

-> this command will never broadcast waited

  1. Erroneous errors in functions - code, error message
bug completed medium

Most helpful comment

About the waiting bug, the fix is super simple
https://github.com/SkriptLang/Skript/blob/01ef3f48f0b7501f7ff1ef3cd8acf07511833885/src/main/java/ch/njol/skript/effects/Delay.java#L84-L88
The duration is gotten after local variables are removed - the lines need to be reordered :)

All 9 comments

p1_code
p1_message

The images since I just realized that github supports uploading images

What version are you on? Bensku has already released multiple hotfix updates that should hopefully fix all of the erroneous type errors. Make sure you're on dev37c.

As for the parsed timespan waiting, that should definitely be investigated.

About the timespan waiting, you have a random ` add the end (could be a typing mistake, but just want to be sure the script doesn't have that)

Sorry about not specifying the version. Just updated the post
The random ` at the end is a mistake after using markdown - also removed.

Weird. Are those the only type errors you're getting for that function? If so, it seems like they start after the first wait, which is interesting.

Yes those are the only errors I get for that function
Also I tried removing the wait and got the same result

Edit: did some testing and found the exact reason for the erroneous warnings.

command /removePotion:
    trigger:
        set {_p} to player
        send "test" to {_p}
        remove JUMP from {_p}
        send "test" to {_p}

adding this to your skript will induce the "local variable '_p' is none" warning on the second send "test"
the remove potion expression for some reason makes skript think that _p's type is empty.

About the waiting bug, the fix is super simple
https://github.com/SkriptLang/Skript/blob/01ef3f48f0b7501f7ff1ef3cd8acf07511833885/src/main/java/ch/njol/skript/effects/Delay.java#L84-L88
The duration is gotten after local variables are removed - the lines need to be reordered :)

Let me split this into two separate issues, this one tracking the already-fixed waiting bug, and the other one tracking the local variables bug

Was this page helpful?
0 / 5 - 0 ratings