Laz Posted March 25, 2013 Posted March 25, 2013 Just did the injection for game messages. Here's an example script: @ScriptManifest(name = "TreeChopper", author = "Lazaro", version = 1.0D, info = "")class TreeChopper extends Script { def treeId = 66812 def chopping = false def currentTree = null int onLoop() { if(chopping && !currentTree.exists()) { chopping = false currentTree = null Logger.log("Chopped down tree!") } if(!chopping) { currentTree = closestObject(treeId) if(currentTree != null) { Logger.log("Closest tree : (${currentTree.getX()}, ${currentTree.getY()})") selectEntityOption(currentTree, "Chop down") } } return 1000 + random(2000) } void onMessage(String message) { if(message == "You swing your axe at the tree.") { Logger.log("Chopping down tree!") chopping = true } }}Obviously it's very basic and doesn't do much but click on trees. But it's just to show how our script API looks like.Sincerely, Laz. 1
Laz Posted March 25, 2013 Author Posted March 25, 2013 It's Groovy, as stated in the ETA thread. We will be supporting Java too.
Carlos Posted March 25, 2013 Posted March 25, 2013 It's Groovy, as stated in the ETA thread. We will be supporting Java too. Alright, your project is going great so far btw! 1
Tyluur Posted March 25, 2013 Posted March 25, 2013 The Script class should have a "log" method. Groovy looks very similar to Java. Gj so far.
Allen Posted March 26, 2013 Posted March 26, 2013 Looking good so far. I'm interesting in seeing the docs, can't wait for April 1st.
Hipi Posted April 1, 2013 Posted April 1, 2013 No way to get sender, message type with this api? [unless this is Groovy having odd syntax??]
Nestle Posted April 2, 2013 Posted April 2, 2013 Looks very nice and tidy, can't wait to see how Java looks.
Developer Maxi Posted April 2, 2013 Developer Posted April 2, 2013 No way to get sender, message type with this api? [unless this is Groovy having odd syntax??] This simply are game messages on the chatbox.