Famous Scripts
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Scripts for RSBot made by Famous
 
HomePortalLatest imagesRegisterLog in
New scripts being created everyday! Go to GameKiller.net!

 

 script to help learning scripting

Go down 
2 posters
AuthorMessage
cool




Posts : 5
Join date : 2010-07-02
Location : Belgium

script to help learning scripting Empty
PostSubject: script to help learning scripting   script to help learning scripting EmptyTue 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!)
Back to top Go down
Sanuka

Sanuka


Posts : 17
Join date : 2010-07-27
Age : 30
Location : Boskoop, the Netherlands

script to help learning scripting Empty
PostSubject: Re: script to help learning scripting   script to help learning scripting EmptyTue 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 Very Happy

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.
Back to top Go down
cool




Posts : 5
Join date : 2010-07-02
Location : Belgium

script to help learning scripting Empty
PostSubject: Re: script to help learning scripting   script to help learning scripting EmptyWed 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 script to help learning scripting Icon_pale
Back to top Go down
Sanuka

Sanuka


Posts : 17
Join date : 2010-07-27
Age : 30
Location : Boskoop, the Netherlands

script to help learning scripting Empty
PostSubject: Re: script to help learning scripting   script to help learning scripting EmptyWed 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 script to help learning scripting Icon_pale
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
Back to top Go down
Sponsored content





script to help learning scripting Empty
PostSubject: Re: script to help learning scripting   script to help learning scripting Empty

Back to top Go down
 
script to help learning scripting
Back to top 
Page 1 of 1
 Similar topics
-
» Need a script for Character
» Tutorial 1: Beginning Scripting
» Script Please?
» script please
» I need a new script please

Permissions in this forum:You cannot reply to topics in this forum
Famous Scripts :: Requests :: Requests-
Jump to: