Jump to content

Server Message Listener


Laz

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...