Sample Scripts
Calling methods from a class, static and non-static:
; Define variables
(set test (new ~FerrScriptTester.TestClass))
(print 'Health initially is:')
(print (get test 'Health'))
; Standard method call
(call test 'Damage' 10)
(print 'Health after damage is:')
(print (get test 'Health'))
; Static method call
(call ~FerrScriptTester.TestClass 'DoSomethingStatic' 4)
(print 'Health after static call is:')
(print (get test 'Health'))
;return value
(test)
Testing a for loop:
(set i 0)
(for (set i 0) (< i 10) 1
(set i (+ i 1))
(print i)
)
(print i)
(i)
Testing Functions:
(defun Add var1 var2
(+ var1 var2)
)
(defun Factorial x
(print (+ 'x = ' x))
(if (== x 1)
(1)
(* x (Factorial (- x 1)))
)
)
(print (+ '12 + 6 = ' (Add 12 6)))
(print (+ '6! = ' (Factorial 6)))
(print (+ 'x = ' x))
(Add 12 6)
Scope testing:
(set global 1)
(body
(set local 2)
(print 'First body:')
(print global)
(print local)
)
(body
(set local 3)
(print 'Second body:')
(print global)
(print local)
)
(print 'Root body:')
(print global)
(print local)