#detect chat

1 messages · Page 1 of 1 (latest)

acoustic goblet
#

How do you detect if someones chat message is something (im making a fake hacks troll and i want it to do smth when you type ".hacks" in chat)

granite siren
#

use the chat event and check the message

crystal linden
#
when chat:
  message is ___```
#

smth like that

#

but do it yourself

snow prawn
#
acoustic goblet
crystal linden
#

k

acoustic goblet
#

i just spelt my original one wrong bc im stupid

#

i put on chart: and somehow didnt notice

crystal linden
#

lol

acoustic goblet
#

is it possible to check for something in a message then (so if i was making a fake hack client, if someone types .give <any item>, it only detects the sencond part)

graceful quiver
#

if message contains "":

acoustic goblet
#

but surely i would have to do that for every item name?

graceful quiver
#

I mean u can prob store the items in a list

granite siren
#

just get the second part, parse it as an item. and give it to the player

acoustic goblet
vivid flicker
#

a really simple method would be:

on chat:
    set {_} to message
    if {_} starts with ".give ":
        cancel event
        replace all ".give " in {_} with ""
        give 1 of {_} parsed as itemtype to player
#

something like that I'm on my phone

#

You're getting the 2nd part after replacing everything else before it with nothing, effectively leaving the 2nd part

#

If you wanted to make this more "dynamic" 💀 you could replace the ., split it at a space, then check what the first element is to see what the "command" that they're doing is

acoustic goblet
acoustic goblet
#

Why does this not work (theres no errors):

    set {_} to message
    if {_} starts with ".enchant ":
        cancel event
        replace all ".enchant " in {_} with ""
        enchant the player's tool with {_}
        send "{@hax} Added enchantment of &l%{_}%&r!"
        delete {_}```
vivid flicker
#

you're enchanting it with a strong

#

String

#

also no need to delete a local variable

acoustic goblet
acoustic goblet
vivid flicker
#

parsed as enchant type

acoustic goblet
#

ahh

#

that errored?

#

enchant the player's tool with {_} parsed as enchant type

vivid flicker
#

no

acoustic goblet
#

what do i need to put

#

oh wait

#

i think i know

vivid flicker
#

remove the

acoustic goblet
#

oh ok

#

still errored

vivid flicker
#

no

acoustic goblet
#

enchant player's tool with {_} parsed as enchant type

vivid flicker
#

enchantmenttype

granite siren
#

its either enchantment type or enchanting type

#

enchant(ing|ment) type[s]

acoustic goblet
vivid flicker
#

yes

acoustic goblet
#

is there a way i can make it so it allows .enchant <enchant> <level>
this is the code now:

    if {_} starts with ".enchant ":
        cancel event
        replace all ".enchant " in {_} with ""
        enchant player's tool with {_} parsed as enchantment type
        send "{@hax} Added enchantment of &l%{_}%&r!"```
acoustic goblet
graceful quiver
#
command .enchant [<text>] [<int>]:
  ``` etc
acoustic goblet
#

wait you can do that?

#

omdss

#

my life is a lie

acoustic goblet
graceful quiver
#

So idk

acoustic goblet
#

im making a fake hack client script in case ur wondering

#

im not trying to use "." based commands like old discord bots do