Jump to content

Need some help with my script please


Ornamental

Recommended Posts

Dear Scripters, 
So i ran into a problem while making my first script, so basically the problem is :
When the item is in my inventory, it has to run to the next case. But the problem is, even when the item is achieved, the bot still spam clicks the Cupboard. Instead if running to the second case.

case GetPicture2:
walking.webWalk(new Position(2984, 3335, 2));
objects.closest("Cupboard").interact("Open");
objects.closest("Cupboard").interact("Search");
if(getInventory().contains("Portrait"));
break;
case GotPicture:
talkNpcInArea("David", David_HOUSE, "Something else.");

break;

 

Any advice would be highly appreciated ! 

Edited by Takes A Nap
Link to comment
Share on other sites

//in the getState method
if(inventory.contains("Picture")) {
   return State.GotPicture;
}

These breadcrumbs should be enough, you need to try to research and learn on your own, it's different to school and being spoonfed.

 

In the State scripts there are 2 parts:

1) setting the State

2) reacting to the State

 

 

1) Setting state: if you have the picture in your inventory, then the state is NOT State.GetPicture is it. Because you already have it! So since you have the picture, set the state as State.GotPicture

 

2) Reacting to the state: now the state is State.GotPicture you can do the next part of the quest.

 

Check your OSBot private messages, I might just teamviewer connect to your PC and help you get this done and explain things to you step by step.

Edited by MegaManAlpha
  • Like 1
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...