Jump to content

Hovering entity's option


Woody

Recommended Posts

                if(myPlayer().getInteracting() != null) {
                NPC npc = npcs.closest(npc_name);
                if (npc != null && npc.isVisible()) {
                    if (hoverEntityOption(npc, "Attack")) {
                        if (myPlayer().getInteracting() != npc) {
                            if (npc.isVisible()) {
                                npc.interact("Attack");
                                log("Attacking " + npc_name);
                                sleep(random(400, 800));
                            } else {
                                camera.toEntity(npc);
                            }
                        }
                    }
                }
            }else {
                if(menu.isOpen()) {
                    if(mouse.click(false)) {
                        for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) {
                            sleep(random(20,40));
                        }
                    }
                } else {
                    if(npc != null && npc.isVisible()) {
                        if(npc.interact("Attack")) {
                            for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) {
                                sleep(random(20,40));
                            }
                        }
                    } else if(npc != null && !npc.isVisible()) {
                        camera.toEntity(npc);
                    } else {
                        log(npc_name + " gone?");
                    }
                }
            }

I'm having trouble implementing your method.

 

What am I doing wrong? The script keeps logging "npc_name gone?"

 

Don't use the method of how to attack a goblin, that was just an example. There are plenty of other tutorials which can help you more. This snippet is meant for those who knows java.

Link to comment
Share on other sites

  • 1 month later...

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...