[Feature Request] Script to read chat
nayfaan opened this issue ยท 8 comments
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?
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?
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
yes, that sounds like what I need. And yes I'm using the latest version on 1.20.4. Thank you!
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
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