I am having some fun learning by trial and error and by browsing Jin source code, which is remarkably clean and easy to understand. I am trying to implement the equivalent of the command "observe high ranked game" where a game between high rated players is automatically picked from the game list and observed. (On FICS.)
This would be a relatively easy task if I could capture the output of the 'games' command. A BeanShell script to sort, select, issue the 'observe' command is not a hard thing at all. But I can't seem to find a way to capture the command output so I can make use of it in this way.
I also notice the 'user event' is commented out in the scripter source code in 2.13. Should I take heed of this, or should I just un-comment and recompile? :)
The problem here is that the servers provide no way of matching the response to the command that triggered it, and so Jin doesn't provide that functionality. Your best option is to just remember that you sent a "games" command and wait for text that looks like the output of "games".
The user triggered events are disabled because the method I implemented to activate them was awkward and unconvenient. They work, but I've disabled them until I write a better UI to activate them.
The problem with the 'raw text' event is that it seems (at least subjectively) to slow things down quite a bit (I'm running Jin on a rather old Linux box, 400 MHz, I think). The other problem is that it is re-called with every line of text making accumulation of output more of a chore.
What I need to do is experiment with coding up something like a 'capture until' function - that is, a script that issues a command and then silently captures console output until a certain string is received (or some fail-safe limit exceeded), and then does something with that captured output. This should be feasible once I figure it out. (I'm not requesting anything here; I really *should* be able to do this on my own!)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.