I have been testing the export from a simple WAIT statement to get the celery script to be able to contain it with LUA via the cs_eval() function as some sequence statements are not directly drivable from LUA. My attempts to get the sequence I want failed so I went for something simple.
Looking at the examples in the documentation the syntax does not look the same.
Is the issue syntax, structure or something else.
I was expecting to be able to cut paste from the displayed celery script into cs_eval to obtain the same result.
Whilst I did not see the documentation (Now found), I modelled my code on this example which executes without issue. I have studied the syntax and cannot see any difference in the structure.
As my code did not work, I asked the question from the beginning as I must be missing something so obvious. The only reason I am attempting to model WAIT is because it is so simple. I am trying to control the LED 3 and LED 4 from LUA which is only available in celery. As I could get that to work I assumed it was because I did not know something so I went for the easiest code possible - and I cannot get that to work either. LOL. I cannot see what I have missed.
I still get the same error and I am totally puzzled.
I can now control more hardware from within LUA code.
The documentation is a little light about the difference between them.
Even now, rereading the documentation cs_eval ‘looks’ like the right one to use, but hey ho.
@roryaronson Are you able to provide some clarity in the documentation about the usage for the two commands?
Is that cs_eval() is expecting an rpc_request, not the CeleryScript straight from the sequence editor. So the CeleryScript for the wait must be put into the body of an rpc_request:
An RPC request is how commands are ultimately formed under the hood in FarmBot OS and used by the CeleryScript Virtual Machine (CSVM). Because it is a bit tedious to write out the full rpc_request syntax every time, we later created rpc() which does the wrapping for you. In taking this shortcut you forego the ability to custom set the label and priority fields of the RPC, but these are really not necessary for 3rd party developers to need to adjust. I would suggest not attempting to use these extra fields or dealing with the added syntax and just sticking with the simpler rpc() command.
I have just updated the developer documentation to point people looking at cs_eval() to use the simpler rpc() function. Hopefully it provides some more clarity.