#How can I run code from a variable

1 messages · Page 1 of 1 (latest)

iron valve
#

Example is like I want to run some code that someone enters into chat but how do I actually run that

quasi wing
#

Here there's a bit about how to use it, you should add capability to the bp manifest

frosty lynx
#
import { world } from "@minecraft-server";

world.beforeEvents.chatSend.subscribe(chat =>  {
    const msg = event.message
    if (msg[0] !== ">") return
    event.cancel = true
    eval(msg.replace(">", "")) 
})
iron valve
spring cypress
iron valve
#

So I can just do eval(world.sendMessage())

spring cypress
#

just try the script m9 gave

iron valve
#

Yea I couldn’t be bothered writing that

#

Ok

spring cypress
#

also when doing a statement, it requires a bracket

iron valve
#

Ik

iron valve
#

How would I do that

spring cypress
tawdry crown
#

what is eval() for btw

spring cypress
tawdry crown
#

thanks

iron valve
#
    if (!msg[0] !== "!run") return
#

Will that still work

#

@spring cypress

spring cypress
iron valve
spring cypress
frosty lynx
iron valve
#

Resolveing

#

/resolve

#

How

frosty lynx
#

/reload

#

can u paste ur code here

iron valve
#

I wanna resolve the post

#

It’s done

frosty lynx
#

ok

iron valve
#

I’ve figured it out

#

But how to add resolved tag

frosty lynx
#

my green tag allows it

#

dw

iron valve
#

What does dw mean?