Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Information about functions


Hi all,

Im really interested in knowing if we can create/define our own functions? if so could some one tell me how to do this.

for example, the first level is using a function called plan(). can i create a function inside of that or is the a feature that allows us to create a function?

Thanks in advance.


*this.say()* throws error "Uppercase or Lowercase problem"

It looks like the answer is “sort of”.

This is legal:

function myfunc(){
    return 7;

if(myfunc() == 7){

If you want your function to call a method or property that would normally require “this”, you’ll need to pass in a reference to the appropriate thang:

function myfunc(thang){


with API protection turned off, you can probably also get away with:

this.myfunc = function (){


However, it does look like levels that use plan() instead of chooseAction() might not handle functions properly, probably due to the whole “planable methods” thing.

(Resolved) Error with function