Gengar Posted January 28, 2014 Share Posted January 28, 2014 Hey Guys, I was following Swizzbeat's youtube video and the written guide for two example scripts and whenever I put them into the OSBot folder it will not play the script. The mouse cursor will simply sit there and not interact with anything even though I followed his guide perfectly. Can anyone help me? I will post my code below for my cow killer script to see if anyone can help. package CowKillerProject; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.rs2.model.Entity; @ScriptManifest(author = "Gengar", info = "Cow Killer", name = "CowKiller .1", version = 0.1) public class cowkiller extends Script{ final String Cow_Name = "cow"; public void onStart(){ log("Start at cows!"); } public int onLoop() throws InterruptedException { Entity cow = closestAttackableNPCForName("Cow_Name"); if (cow !=null){ if (!client.getMyPlayer().isUnderAttack()) if (cow.isVisible()){ cow.interact("Attack"); }else{ client.moveCameraToEntity(cow); } } return 50; } public void onExit(){ log("Thank you for using my script!"); } } Link to comment Share on other sites More sharing options...
Swizzbeat Posted January 28, 2014 Share Posted January 28, 2014 (edited) Why does everyone think that's my video? I explicitly state in the line before it that @H0ppy made it O_o And no offence but I suggest learning Java before scripting. The error you made is extremely easy to spot (look at the argument your passing to the closest...NPC() method). Edited January 28, 2014 by Swizzbeat 1 Link to comment Share on other sites More sharing options...
Gengar Posted January 28, 2014 Author Share Posted January 28, 2014 Sorry lol, I had my headphones turned down at the very beginning, and I am currently in college for java programming so I figured that this would some good practice on the side. Link to comment Share on other sites More sharing options...
Artemis Posted January 29, 2014 Share Posted January 29, 2014 (edited) Entity cow = closestAttackableNPCForName("Cow_Name"); should be: Entity cow = closestAttackableNPCForName(Cow_Name); (No quotation marks) Quotation marks are for strings. If you want to use a variable you don't use quotation marks. Also you should look up some Java Naming Conventions: http://en.wikipedia.org/wiki/Naming_convention_(programming)#Java Your class should be CowKiller. It's not something that affects your code but it is something that makes your code more readable. Edited January 29, 2014 by Artemis Link to comment Share on other sites More sharing options...
Gengar Posted January 29, 2014 Author Share Posted January 29, 2014 Alright thanks! I am currently studying more and I sometimes mix things up between java and C++ :P Link to comment Share on other sites More sharing options...