1
I'm making a RPG dialogue system in 1.14.3 using command blocks. Basically the Character will say something to start the conversation and then a command block will /tellraw some colored text saying "Option 1: ("Whatever option one is")" and then option 2, 3, etc. Then the player simply types in chat, the number of the option they pick. When you pick option 1 for example it will be detected by a command block and the character would respond with an answer that corresponded to what you said. Everything is fine except that I have no clue how to detect if player types a certain number in chat. Since /testfor no longer exist I don't know how. I know that /tellraw has click events but I was wondering if there is a simpler way because /tellraw is entire new format and requires very very long lines of code. (I've also heard it takes forever and is buggy and do not have time for that.) Any help is greatly appreciated.
8
The Bukkit API (and Spigot by extension) support the AsyncPlayerChatEvent, it can return the string of the message, as well as info about the player who said it. Via a simple RegEx or just with a substring check (or an .equalsIgnoreCase()) you can check against a list of options, or just capture the entire string, if you need things like names entered. You can then add rules like how many words it can have by more of the above. If you know Java, you can easily make a plugin that handles this and passes the data off to whatever plugin you use for classes and stuff. It can’t be done via command blocks, so you’d have to ditch those.
Not a command, but still a possible option.
Edit: Not sure if you are making a single player map, then nothing really works. Just re-read your question and seems like that’s the case.
Cheers,
Dusan
Not a command, but still a possible option.
Edit: Not sure if you are making a single player map, then nothing really works. Just re-read your question and seems like that’s the case.
Cheers,
Dusan
it is a single player map. I know there has got to be a way to do this with commands...I'm really close... Since then I have switched to click events where you click and it gives a select score on a objective which would activate the next click even (Dialogue tree)...the problem I have now is that once these click events are powered you have to send another signal to update the execute if command (testfor) but I can't put a clock and I can't put a repeat command block because I only want the dialogue to show up once. Literally all I need is the command block to testfor a score and activate once....this is so simple that I'm finding it hard to believe it can't be done.
Theres no vanilla command that supports this feature, but i'm pretty sure there's a plugin that allows this.
Ok. Since then I have switched to click events where you click and it gives a select score on a objective which would activate the next click even (Dialogue tree)...the problem I have now is that once these click events are powered you have to send another signal to update the execute if command (testfor) but I can't put a clock and I can't put a repeat command block because I only want the dialogue to show up once. Idk how to fix this. Is there a way to have a repeat command block but it only sends one output then stops?
Simply have the repeating command block executing at player with or without a certain tag and then in a chain command block after it add or remove that tag.
For example:
For example:
- In the repeating command block: /tellraw @a[tag=!told1] {"text":"Hello! Have you heard..."}
- Then in the chain command block: /tag @a add told1
