help the using Script Executor in the lab tool

I’m looking for help/hints/write-ups on using the new Script Executor feature in the lab tool. Is there a wiki page or document I could look at for reference/examples? I haven’t found anything yet poking around in the blogs wiki or forum. Thanks.

3 Likes

Same here.

Hey all!

Your best bet for now will be just looking at the existing scripts marked “[Booster]” as an example. We will need to get solid documentation, but here’s some basic information:

Boosters act just like regular EternaScripts, but are executed from the game page instead of the script page. The benefit of this is being able to interact with the Flash applet, which has an exposed API. You’ll first need to do something like  var applet = document.getElementById('maingame'); in order to get a reference to the applet. From there, you can call a number of functions to read and/or update the game state. While I don’t have a  complete reference of functions (Nando, you may be able to provide a list of functions/parameters/usages?), here are some of the basic ones which I know of that you’ll probably want:

  • get_full_sequence(state)  - Get the entire sequence (including Oligos) for the given state (0 based, so state could be a number 0 through the number of states minus one)
  • get_full_structure(state)  - Get the entire structure (including Oligos) for the given state (0 based as in get_full_sequence)
  • set_sequence_string(sequence)  - Set the sequence (excluding Oligos, probably excluding locked bases period but I’m not positive) using a standard AUGC sequence string
    You can also use the Eterna Web API as normal within an EternaScript, and you can modify the webpage around the applet (or use alert or console.log or so forth) to create your own UI (ie something like $("body").append(" Something goes here " ) if you want to use jQuery automatically loaded with Eterna’s JS), though the EternaScript “pervasives” are not available as far as I know.

Keep in mind that at the moment you cannot run other users scripts, you need to own the script, though I imagine in the future that will change.

Let me know if you have further questions, hopefully the devs can provide more details on the applet API.

I wrote a short documentation on the wiki. If something needs clarifications, let’s use the Talk page to discuss them. Thanks.

1 Like

Thanks, guys