Jump to content

Need some help with my script please


Recommended Posts

Posted (edited)

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
Posted (edited)
//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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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