Jump to content

C0de help


Prismo

Recommended Posts

hi guys !

trying to write my own script , 

could you please show me an example of how to interact with a entity ie oak tree (correctly) 

once i define a entity ie "oak tree" do i have to write full name in other lines? or just "tree"

private State getState() {
        Entity Oak_tree = getObjects().closest("Oak tree");
        if (!inventory.isFull())
            return State.BANK;
        if (Oak_tree != null)
            return State.CHOP;
        return State.WAIT; 

 

a snippet of how to change camera angle would me epic also! 

i have 
                this.client.rotateCameraPitch(50 + random(40));

the rotatecamerapitch part has no reference :\ 

would appreciate any help , thank you ! 

Edited by Prismo
Link to comment
Share on other sites

9 minutes ago, Prismo said:

hi guys !

trying to write my own script , 

could you please show me an example of how to interact with a entity ie oak tree (correctly) 

once i define a entity ie "oak tree" do i have to write full name in other lines? or just "tree"

private State getState() {
        Entity Oak_tree = getObjects().closest("Oak tree");
        if (!inventory.isFull())
            return State.BANK;
        if (Oak_tree != null)
            return State.CHOP;
        return State.WAIT; 

 

a snippet of how to change camera angle would me epic also! 

i have 
                this.client.rotateCameraPitch(50 + random(40));

the rotatecamerapitch part has no reference :\ 

would appreciate any help , thank you ! 

RS2Object oak = getObjects().closest("Oak tree");

^after doing this ur oak tree will be "oak" in the script and use the above line to define it

so example:

 if (oak != null && oak.interact("Chop")) {

^ now it will chop a oak (oak = Oak tree) if u get what i mean ? 

 

also camera change:

getCamera().mouseRotateToYaw((100));

 

hope this helps you out :gnome:

  • Like 1
Link to comment
Share on other sites

public boolean chopTree(String treeName) { //run this code until it returns a value

        if (!myPlayer().isAnimating()) { //WE ARE NOT CUTTING THEN WE CUT
            status = "Waiting for Tree.";
            RS2Object tree = getObjects().closest(treeName);
            if (tree != null) {
                if (tree.interact("Chop down")) {
                    status = "Cutting Tree.";
                    new ConditionalSleep(3500, 600) {      //sleep until chopping
                        @Override
                        public boolean condition() {
                            return myPlayer().isAnimating(); // We're chopping/Animating.
                        }
                    }.sleep();
                    return true; //we have clicked the tree!
                }
            }
        }

        return false;

    }

Here's my chopping tree code if it's any use.

Edited by HeyImJamie
  • Like 3
Link to comment
Share on other sites

7 minutes ago, Prismo said:

ah yes! it has all become clear now! :D nah thanks heaps guys ! 1+

@HeyImJamie Ty for code mate, i am not quite at that level, with the conditions and all...  ty for post !

Copy it if you need. All you need to do is store a tree name as a String, and then in the loop is call chopTree(STORED_STRING_HERE). Saves you having to re-type it for multiple trees :) 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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