Laz Posted March 25, 2013 Share 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 Link to comment Share on other sites More sharing options...
Carlos Posted March 25, 2013 Share Posted March 25, 2013 What programming language is this? Link to comment Share on other sites More sharing options...
Laz Posted March 25, 2013 Author Share Posted March 25, 2013 It's Groovy, as stated in the ETA thread. We will be supporting Java too. Link to comment Share on other sites More sharing options...
Carlos Posted March 25, 2013 Share 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 Link to comment Share on other sites More sharing options...
Tyluur Posted March 25, 2013 Share Posted March 25, 2013 The Script class should have a "log" method. Groovy looks very similar to Java. Gj so far. Link to comment Share on other sites More sharing options...
mad turnip Posted March 25, 2013 Share Posted March 25, 2013 Looking great laz keep it up! Link to comment Share on other sites More sharing options...
Allen Posted March 26, 2013 Share Posted March 26, 2013 Looking good so far. I'm interesting in seeing the docs, can't wait for April 1st. Link to comment Share on other sites More sharing options...
Hipi Posted April 1, 2013 Share Posted April 1, 2013 No way to get sender, message type with this api? [unless this is Groovy having odd syntax??] Link to comment Share on other sites More sharing options...
Nestle Posted April 2, 2013 Share Posted April 2, 2013 Looks very nice and tidy, can't wait to see how Java looks. Link to comment Share on other sites More sharing options...
Developer Maxi Posted April 2, 2013 Developer Share 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. Link to comment Share on other sites More sharing options...
Soul Posted April 2, 2013 Share Posted April 2, 2013 When would we expect OSBot to support Java? Link to comment Share on other sites More sharing options...