#Variables

1 messages · Page 1 of 1 (latest)

neat cedar
#

Here is my code, I have multiple game instances within the server all called "em_1", "em_2", "em_3" etc. I need it to detect on the death of the player what world they are in (game instance). Say it be "em_1" then I need to take that 1 part and set it to the {_instance}. Is there any way of doing that?

    if {_instance} contains "em_":
        set {_instance} to ""
        teleport victim to {prelobby.%{_instance}%}```
storm warren
#

check the world?

opal trout
#

you never set {_instance} (a local variable) anywhere in that code, so you can't use it. and besides, you can just detect the world of player

neat cedar
#
    set {_worldName} to world name of location of victim
    send "%{_worldName}%" to victim```

here is a more updated code, however doesnt work. it seems simple but im sure i have tried it all lol. All i need to do is get the world the player died in and then send it to them
#

oh yeah that is the issue, it sends the world name <none> which obviously isnt the case

lusty ledge
#

The player doesnt have a location (its dead)

#

Try event location

#

Or event world

neat cedar
#

Ive done

set {_worldName} to world name of event location

and

{_worldName} to event world

but errors on those

tardy mango
#

you're forgetting the -

neat cedar
#

i could have sworn I added the - before

#

thank you lol

#
    set {_worldName} to event-world
    send "%{_worldName}%" to victim
    if {_worldName} contains "em_":
        wait 1 tick
        replace all "em_" with "" in {_worldName}
        wait 1 tick
        set {_instance} to {_worldName}
        teleport victim to {prelobby.%{_instance}%}```

There are no errors within this code, however, when dying in the world em_1 the code isnt reacting to that depsite the ```if {_worldName} contains "em_":``` any ideas
lusty ledge
#

Try making the world name a string maybe?