help the using Script Executor in the lab tool

  • 3
  • Question
  • Updated 3 years ago
  • Answered
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.
Photo of jandersonlee

jandersonlee

  • 555 Posts
  • 130 Reply Likes

Posted 3 years ago

  • 3
Photo of Rocketdog42

Rocketdog42

  • 33 Posts
  • 2 Reply Likes
Same here.
Photo of LFP6

LFP6, Player Developer

  • 613 Posts
  • 109 Reply Likes
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("<div>Something goes here<div>") 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.
(Edited)
Photo of nando

nando, Player Developer

  • 388 Posts
  • 71 Reply Likes
I wrote a short documentation on the wiki. If something needs clarifications, let's use the Talk page to discuss them. Thanks.
Photo of Rocketdog42

Rocketdog42

  • 33 Posts
  • 2 Reply Likes
Thanks, guys