const scheduleID = system.runSchedule(() => {
system.clearRunSchedule(scheduleID);
player.addTag('test');
letter_process = -1;
}, text.length);```I used to use this for a piece of my code but since `runSchedule` has been removed I'm not exactly sure what I can do for a replacement of this. Can I get some help on this? (I know it's been updated to `runInterval` but I just don't know what I would use for the `clearRunSchedule`)
#What can I do now?
1 messages · Page 1 of 1 (latest)
send code
import { system, world } from '@minecraft/server'
var letter_process = 0;
system.runInterval(() => {
[...world.getPlayers()].forEach((player) => {
if (!player.hasTag('test')) {
var text = 'This is some example text.';
if (letter_process < text.length) {
letter_process = letter_process + 1;
}
player.onScreenDisplay.setActionBar(`${text.substring(0, letter_process)}`);
player.runCommandAsync(`playsound random.click @s ~~~ 1.0 1.5`);
const scheduleID = system.runSchedule(() => {
system.clearRunSchedule(scheduleID);
player.addTag('test');
letter_process = -1;
}, text.length);
}
});
});```
It used to work fine but like I said, the runSchedule and clearRunSchedule are not a think anymore so I'm not sure what I could do to fix it.
system.runTimeout(() => {
player.addTag('test');
letter_process = -1;
}, text.length)
i was thinking about this way too hard if that's what fixes it lmao
this issue now is that the message doesn't finish, it just stops after about a second
it displays each character one by one until the message has reached the end of the text
like 1 char after every 26 ticks?
it just needs to run by adding 1 character at a time to the actionbar until it reaches the end of the given var text which is why it is set to text.length
however, when told to so it doesn't want to finish the message before stopping
@regal maple this is all it managed to push out before stopping
then afterwards its always this, using runTimeout doesn't seem to give it enough time to read the text
var letter_process = 0;
system.runInterval(() => {
[...world.getPlayers()].forEach((player) => {
var text = 'This is some example text.';
if (!player.hasTag('test')) {
if (letter_process < text.length) {
letter_process++;
}
player.onScreenDisplay.setActionBar(`${text.substring(0, letter_process)}`);
player.runCommandAsync(`playsound random.click @s ~~~ 1.0 1.5`);
system.runTimeout(() => {
player.addTag('test');
letter_process--;
}, text.length * 2)
}
});
});
thanks!