Please
do not provide answers involved the Simplified_Scripting system. All questions are looking for solutions that will go into the onGMCP function, so
please, pretty-please-with-a-cherry-on-top, do not provide answers involved the Simplified_Scripting system.
- Capture text in advanced scripting (trigger without touching the simplified scripting system).
- Write a Wait For trigger in advanced scripting system (inside a function inside of the onGMCP reflex).
- Conditional triggers. If (captured text && variableTrue) {do this};
- Connect multiple triggers. If A then B, do E, but not if B happens without A or if A occurs after B. Also, if C then D, do E, but not if D happens without C or if C occurs after D.
Answers
Answer: You cannot capture text within the onGMCP function. Any triggers youc reate here will be separate reflexes and appear below the . onLoad function and the onGMCP function.
Based on your questions, you might want to look at the onBlock function. That function is called every time a prompt is printed. Prompts are hidden by default in the Nexus client, but if you want to get an idea how often onBlock gets called, you can turn prompts on by unchecking both "do not show prompts" and "only show the last status/prompt line received" and you will see every time a prompt comes up. onBlock is given all the text that was sent to the client before the most recent prompt. You can inspect what has been sent in and make many of the types of decisions that you're asking about using this information.
Between onGMCP and onBlock you can capture all the information the server sends to the client. You will get it in pieces, however, and you cannot "wait" so your code will have to use a more asynchronous paradigm.
I’d like to send a command IF a gmcp arg equaled a string and wait for a particular trigger text before sending a second command.
I can’t seem to get .then resolve reject to render correctly.
onGMCP: inspect message and arguments, and if it's interesting ...
onTrigger: take an action, but only if a recent onGMCP was interesting.
If so, all you need to do is set a flag in onGMCP, and inspect then clear it in the trigger.
Is this the correct syntax?
reflex_find_by_name('trigger’, ‘styna_trigger’);
reflex_enable(‘styna_trigger’);
reflex_disable(‘styna_trigger’);
note: I mean to use straight quotes where the curly ‘ is in the code above, but my keyboard won’t let me type it out in this example.
Question: is the syntax above correct? Is the reason why styna_trigger isn’t working is that it’s enabled too late? Would enabling it beforehand capture the text?
I started with a block statement in onGMCP. It says IF gmcp method matches a string (check IF gmcp argument matches a string) then send command #1.
Command #1 causes the client to receive gmcp data. I use an IF statement and loop through the gmcp arguments to see if it matches a string. If the string is -1/undefined/missing, then send command #2.
Wait For a particular line of text to return from command #2. If the line is not returned, exit out. If the line is returned, send command #3.
> }
> else stepCount =0;