CheatUtils by Zergatul

CheatUtils by Zergatul

32.5k Downloads

[Feature Request] Script to read chat

nayfaan opened this issue ยท 8 comments

commented

Is it possible to have a function that gets the last (few) line our chat box / command feedbacks?

...and is there a sleep/wait function to insert pauses into a script?

commented

You can't normally sleep from script, because it is getting executed in the main thread. Sleep with just cause hanging.
You can use this:

delayed.run(10, () => {
    // your code
    // it will be executed after 10 ticks passed
});

As for chat, I can add this. Maybe it will be better to have dedicated event for Events Scripting module:

events.onChatMessage(() => {
    string message = chat.getCurrentMessage();
    // ...
});

But there is not much string methods you can use, so probably you will not be able to do some sort of string parsing. What you are trying to achieve?

commented

I have a command that does things and gives a feedback in chat when it's done processing. I would like the script to wait for that feedback line before sending the next command to main

commented

Ok, then events should be the best place for it. Are you using 1.20.4 version?

commented

yes, that sounds like what I need. And yes I'm using the latest version on 1.20.4. Thank you!

commented

sorry but i dont have a clue what is matrix like i said im new to this

commented

hello i am trying to make a code that will wait a few seconds before runing so i tried the first code and it dident work like my name sugests i am new to code so pls do you know what im doing wrong
and yes i know i have spelling mistakes

commented

hello i am trying to make a code that will wait a few seconds before runing so i tried the first code and it dident work like my name sugests i am new to code so pls do you know what im doing wrong and yes i know i have spelling mistakes

Join matrix server and show your code

commented

Ability to process chat messages added in 2.13.2 version