cool
Posts : 5 Join date : 2010-07-02 Location : Belgium
| Subject: script to help learning scripting Tue Jul 27, 2010 6:36 am | |
| Ok, after some hours of searching, I've found what i did wrong. Kan someone close this thread? Thnx for the help
Last edited by cool on Wed Jul 28, 2010 10:48 am; edited 1 time in total (Reason for editing : delete this!) | |
|
Sanuka
Posts : 17 Join date : 2010-07-27 Age : 30 Location : Boskoop, the Netherlands
| Subject: Re: script to help learning scripting Tue Jul 27, 2010 1:49 pm | |
| Are you sure you wouldn't rather try it yourself? I mean you can get the basic structure from the tutorial, and use the RSBot Programming Cheat Sheet link in my siggy to look up functions and what they do. Let's go step by step to the simplest WC script, purely for exp gain. 1. Check for hatchet (bronze) 2. Check for tree. 3. Find the nearest tree 4. Click the tree 5. Repeat until the inventory is full. 6. If inventory is full drop all items except your hatchet 7. REPEAT So thats all the steps. (note that I only just started scripting too so don't flame me D:) So this is what I made in 15 - 20 minutes, yes it's basic but it gets the job done. Powerchopping style. - Code:
-
import java.awt.*; import java.util.*;
import org.rsbot.bot.Bot; import org.rsbot.script.*; import org.rsbot.script.wrappers.*; import org.rsbot.event.listeners.*; import org.rsbot.event.events.*;
@ScriptManifest(authors = { "NoWay" , "Cool" }, category = "Woodcutting", name = "NoWayEdgeChop", version = 1.0, description = "NoWayEdgeChop, by NoWay & Cool from Famousscripts forum. No options available.") public class NoWayEdgeChop extends Script{ private int B_Hatchet = 202; private int N_Tree = 202; private int WC_Anim = 202; private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
public boolean onStart(Map args) { // All commands you want executed when the script starts goes here log("Hello! And welcome to NoWayEdgeChop!"); return true; }
public void onFinish() { // All commands you want executed when the script finishes goes here log("Thank you for using NoWayEdgeChop"); }
public int loop() { // This is your main code if((!inventoryContains(B_Hatchet))){ log("You don't have a Bronze hatchet in your inventory, aborting."); } if(isInventoryFull()){ dropAllExcept(B_Hatchet); } if(!(getMyPlayer().getAnimation() == WC_Anim) &| !isInventoryFull()){ final RSObject Norm_T = getNearestNPCByID(N_Tree); atTree(Norm_T, "Heck"); } return 1337!!; } }
yes there are some intentional errors in there, so you can't just decide to copy paste n claim you've made a script. You will have to understand what the program does and why it does that. | |
|
cool
Posts : 5 Join date : 2010-07-02 Location : Belgium
| Subject: Re: script to help learning scripting Wed Jul 28, 2010 4:32 am | |
| Thanks, I've learned about it, but I still have a problem to put the banking into the script | |
|
Sanuka
Posts : 17 Join date : 2010-07-27 Age : 30 Location : Boskoop, the Netherlands
| Subject: Re: script to help learning scripting Wed Jul 28, 2010 7:05 am | |
| - cool wrote:
- Thanks, I've learned about it, but I still have a problem to put the banking into the script
there's a banking code in one of the tutorials by famous, just do it like i showed before. make the steps and program them then check for any problems it might get like bank not opening and program that in too | |
|
Sponsored content
| Subject: Re: script to help learning scripting | |
| |
|