Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading from the output buffer from Lua. #41

Closed
lisdude opened this issue May 29, 2020 · 2 comments
Closed

Reading from the output buffer from Lua. #41

lisdude opened this issue May 29, 2020 · 2 comments
Labels
question Further information is requested

Comments

@lisdude
Copy link
Contributor

lisdude commented May 29, 2020

I've implemented the arguably more complex MCP 2.1 protocol in Lua just fine. However, a lot of old MOOs don't support MCP 2.1, so I was adding support for the original MCP 1.0 simpleedit, which looks like this:

#$# edit name: Wizard:some_verb upload: @program #2:some_verb
{x, y, z} = args;
player:tell("This is some code.");
return x * y * z;
.

It's easy enough to set up a trigger to capture the title and upload command from the first line. Where I'm having trouble, however, is catching the verb code. Anything between the #$# line and the single period at the end is verb code that needs to be captured.

I'm not sure how to do that, or even what suggestion to make to catch that code. The best I could come up with is creating a catch-all trigger in the first callback (which seems kind of gross) until it gets the single period, but then I can't remove the trigger. I could have a flag that dictates whether or not I'm interested in each line, but having every single line from the server get caught and pass through the callback seems inefficient.

Any ideas?

@lisdude lisdude added the question Further information is requested label May 29, 2020
@LiquidityC
Copy link
Member

Conditional multi line capturing is always tricky. I think your best bet is a catch all trigger and some sort of state machine for now. Once either "removing triggers" or disabling triggers is in it should be easy to solve.
I don't really have a big priority list at the moment so I could take a quick look at disabling and deleting triggers.

@lisdude
Copy link
Contributor Author

lisdude commented May 31, 2020

Trigger removal worked perfectly! Thanks! Now my MCP package supports both the "modern" MCP 2.1 simpleedit and the ancient LambdaMOO non-MCP local edit. 😁

@lisdude lisdude closed this as completed May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants