And back on topic...
After quite a bit of debugging I've gotten the scripting engine running with basic functions.
Test Script:
Code:
(var boolean test_boolean false)
(var boolean test_boolean2 true)
(var int test_int 1)
(var int test_int2 125)
(var int test_int3 -10020)
(script all dormant "test"
(if test_boolean
(begin
(log "test boolean is true")
)
(begin
(log "test boolean is false")
)
)
(if (== test_int2 125)
(begin
(log "equals")
)
(begin
(log "not equals")
)
)
(log (<= 1 4))
)
Interpreter output:
Code:
- (script all dormant "test" <4> <10> <12> )
-- Call:If ID#4 Src: (if <-1> <1> <3>)
--- Call:Variable ID#-1 Src: test_boolean
--- Call:Begin ID#1 Src: (begin <0>)
---- Call:Log ID#0 Src: (log <-1>)
----- Call:Constant ID#-1 Src: test boolean is true
--- Call:Begin ID#3 Src: (begin <2>)
---- Call:Log ID#2 Src: (log <-1>)
----- Call:Constant ID#-1 Src: test boolean is false
-- Call:If ID#10 Src: (if <5> <7> <9>)
--- Call:Equals ID#5 Src: (== <-1> <-2>)
---- Call:Variable ID#-1 Src: test_int2
---- Call:Constant ID#-2 Src: 125
--- Call:Begin ID#7 Src: (begin <6>)
---- Call:Log ID#6 Src: (log <-1>)
----- Call:Constant ID#-1 Src: equals
--- Call:Begin ID#9 Src: (begin <8>)
---- Call:Log ID#8 Src: (log <-1>)
----- Call:Constant ID#-1 Src: not equals
-- Call:Log ID#12 Src: (log <11>)
--- Call:Lequal ID#11 Src: (<= <-1> <-2>)
---- Call:Constant ID#-1 Src: 1
---- Call:Constant ID#-2 Src: 4
And when I enter wake test into the console I get this in the log:
Code:
test boolean is false
equals
true
If you'll notice the interpreter output is quite informative now 
And if you look closely you might find some built in casting. Mmmmmm girllllll. Look at that casting.
Writing custom functions is pretty easy to do. Though writing functions that stop the scripting language is a bit complex. (stuff like sleep and begin). I learned a lot about interpreting code like this though so next time it'll be better
In the end it's all functional so yay.
What kind of functions would you guys like to see. Stuff you wish halo had basically.
edit-
@Skyline:
Scala isn't any faster than java from what I've read. It's also not as widely used as java. I don't see any reason to switch unless I run into some major problem that I can't do with java (spoilers: I won't).
Bookmarks