anScript

Draw graph (passing instruction and math expressions as aguments)

In this example there is a very interesting instruction drawShape(expression, expression, instruction, r, g, b). Please note, that expressions and instructions are not variables, so they cannot be passed by value.

Use timeWait() at the end of code to see output.

variableCreate(X,200.i)
variableCreate(Y,200.i)
graphicWindowCreate(X,Y,graph.s)
graphicWindowSetPointSize(1.f)
X.variableToFloatNumber()
Y.variableToFloatNumber()

instructionCreate(drawShape,expressionR,expressionL,comperator,r,g,b)
    variableCreateLocal(x,0.f)
    variableCreateLocal(y,0.f)
    variableCreateLocal(i,var.f)
    variableCreateLocal(j,var.f)
    variableCreateLocal(logic,var.f)
    logicLoopF(x,X)
        y.variableAssign(0.f)
        logicLoopF(y,Y)
            i=expressionL
            j=expressionR
            logic.comperator(j,i)
            logicIf(logic)
                x.variableToIntegerNumber()
                y.variableToIntegerNumber()
                graphicWindowSetPoint(x,y,r,g,b)
                x.variableToFloatNumber()
                y.variableToFloatNumber()
            }
        }
    }
    variableDeleteLocal(x,y,logic,i,j)
}
drawShape(y,x*x,comparisonIsGreater,50.i,70.i,0.i)
drawShape(y,x,comparisonIsLess,10.i,70.i,60.i)
drawShape(y,x/5.f,comparisonIsLess,200.i,70.i,60.i)