#Trouble with a skript

1 messages · Page 1 of 1 (latest)

hoary tinsel
#

Im having trouble with a skript and I can't find an answer online

    set {room.occupied::%loop-number%} to false
on region enter:
    if "%region at player%" contains "portal":
        loop 10 times:
            if {room.occupied::%loop-number%} is false:
                set {room.occupied::%loop-number%} to true
                set {_region} to region "sr%loop-number%"
                set {_location} to the center of {_region}
                teleport player to {_location}
                send "&aYou have been teleported to room %loop-number%!"
                stop
        else:
            send "&cAll rooms are currently occupied. Please try again later."
on region exit:
    loop 10 times:
        if "%region at player%" contains "sr%loop-number%":
            set {room.occupied::%loop-number%} to false
            stop```
#

i get an error on all the loops and i can't tell if i have errors on the rest of the code because it wont even start

real kettle
#

also u cant just loop 10 times like the first 2 lines

hoary tinsel
#

oh ok

#

cant understand this structure: loop 10 times

real kettle
#

did u remove the first 2 lines

hoary tinsel
#

i just did

#

now it just says

real kettle
#

show current code and send screenshot of error

hoary tinsel
#
    if "%region at player%" contains "portal":
        loop 10 times:
            if {room.occupied::%loop-number%} is false:
                set {room.occupied::%loop-number%} to true
                set {_region} to region "sr%loop-number%"
                set {_location} to the center of {_region}
                teleport player to {_location}
                send "&aYou have been teleported to room %loop-number%!"
                stop
        else:
            send "&cAll rooms are currently occupied. Please try again later."
on region exit:
    loop 10 times:
        if "%region at player%" contains "sr%loop-number%":
            set {room.occupied::%loop-number%} to false
            stop```
real kettle
#

move the else 1 tab forward

hoary tinsel
#

ok

real kettle
#

and the send below it as well

#

and for the region 1s lemme check

#

is center a thing?

#

i cant find it in docs

hoary tinsel
#

ok

#

i guess i can set a location

#

for each variable

#

and then just put a loopnumber next to it??

real kettle
#

you can do like {room.occupied::%loop-number%::location} or something

#

also my mistake if u move the else a tab it might spam the "all rooms...."