Solved If "region was"...

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

PatoFrango

Active Member
Jul 12, 2017
240
14
18
Hello,

I would like to know if there is a condition that, instead of being
code_language.skript:
if "%region at player%" contains "regionname":
It calculates the region in which the player was before, like 1 tick ago, like
code_language.skript:
if "%region at player%" contained "regionname":

Thank you for your time.
 
Hello,

I would like to know if there is a condition that, instead of being
code_language.skript:
if "%region at player%" contains "regionname":
It calculates the region in which the player was before, like 1 tick ago, like
code_language.skript:
if "%region at player%" contained "regionname":

Thank you for your time.
the region that the player was in 1 tick ago is most likely the same region theyre still currently in
 
oh

straight from the docs http://bensku.github.io/Skript/events.html#region_enterleave
code_language.skript:
on region exit:
message "Leaving %region%."
Still no.

code_language.skript:
on region exit:
    wait 1 tick
    if "%last entered region%" contains "regionname":
        effects

That's what I'm trying to do. If I just put "on region exit" and then the effects, it will execute those effects in whatever region I leave. I want to execute the effects when the player leaves that and only that specific region.
 
Still no.

code_language.skript:
on region exit:
    wait 1 tick
    if "%last entered region%" contains "regionname":
        effects

That's what I'm trying to do. If I just put "on region exit" and then the effects, it will execute those effects in whatever region I leave. I want to execute the effects when the player leaves that and only that specific region.
what
 
Still no.

code_language.skript:
on region exit:
    wait 1 tick
    if "%last entered region%" contains "regionname":
        effects

That's what I'm trying to do. If I just put "on region exit" and then the effects, it will execute those effects in whatever region I leave. I want to execute the effects when the player leaves that and only that specific region.

When you say effects, what do you mean? Like, just run some code after it, or execute some particle effects at the location, or apply some potion effects?
 
i dont understand why on region exit wont work?
code_language.skript:
on region exit:
    set {_last_entered_region} to region
    wait 1 tick
    #do stuff
 
Run code.

Okies;
So, when you use some events, those events have special expression build into them; for example:
  • events that deal with locations can use %event-location%
  • events that deal with items can use %event-item%
  • and events that deal with regions can use %region%
The wording for these special expressions is important, and a lot of the time there is no documentation about what expressions you're able to use in what events.

So, for your example, I could make a region called "test" with WorldGuard and use the following code:
code_language.skript:
on region exit:
    "%region%" contains "test"
    message "%region%"
If it works, you'll notice that the %region% expression returns "regionName in world world", which is why we need to use the contains condition when dealing with WorldGuard regions.
 
Okies;
So, when you use some events, those events have special expression build into them; for example:
  • events that deal with locations can use %event-location%
  • events that deal with items can use %event-item%
  • and events that deal with regions can use %region%
The wording for these special expressions is important, and a lot of the time there is no documentation about what expressions you're able to use in what events.

So, for your example, I could make a region called "test" with WorldGuard and use the following code:
code_language.skript:
on region exit:
    "%region%" contains "test"
    message "%region%"
If it works, you'll notice that the %region% expression returns "regionName in world world", which is why we need to use the contains condition when dealing with WorldGuard regions.
Oh, now I see how dumb I can be. I was using %region at player% instead of just %region%. Thank you!
 
Status
Not open for further replies.