I'm trying to use the "getX" thing that I found in the API to check if I'm on the correct tile during my LOOK state. I believe that I'm supposed to import something, and I want to make sure this works.
import org.osbot.rs07.script.Position;
It won't let me import this and I dont know why..
//EDIT:
Going to read the 2nd person's post and try to add stuff in, my LOOK state looks like it might be coming together finally! ;D Here's my code so far:
http://pastebin.com/EBGFwGBi
//EDIT 2:
My script officially can find the knife in the spot it spawns and grabs it! this is so exciting for me haha.
I'm assuming my script will just sit here and wait until the next knife spawns until my inv gets full, but it would take ages to wait for that.. so looks like I need to find a way to make my player hop worlds. When my inventory gets full (I can buy more knives for testing purposes to fill it up, thats not a problem) we gotta check what floor we're on until we get to the top floor. Instead of making it click the staircase it would be cool if there was a way to make it go to the tile beside the staircase and then click the stairs, but hey whatever works. This would probably just be helpful in coding another script where instead of going up stairs I could just walk to the next destination. For instance if I were going to edit this to grab fire runes in al kharid mining area then walk to the bank there I could use some destination/position code. Here's what I got so far, I'm trying to play around with the STEAL state and with the 0, 1, 2 cases inside that currently. Sorry about the multiple edits http://pastebin.com/j5R9pWWt
//EDIT 3:
I think I've made some good progress, my script can now hop worlds and when my inventory is full it goes up the stairs. One thing I'm going to try to figure out later is how i can get it to actually bank, getting my player to go up the stairs was easy lol but getting him to actually bank and go back down seems pretty difficult. I've been getting some strange error and i'll post it with my code afterwards. Just wanna say you guys have helped me a lot and I appreciate it. I'm still a little stuck on the multiple cases thing in my script to determine what to do depending on what floor i'm on.
[ERROR][bot #1][11/03 04:39:30 PM]: Error in script executor!
java.lang.NullPointerException
at Main.onLoop(Main.java:85)
at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(vk:145)
at java.lang.Thread.run(Unknown Source)
http://pastebin.com/H5Yd8ZNM All constructive criticism to make this grabber skeleton better is greatly appreciated! Hopefully other scripters new and old can learn a thing or two.
//EDIT 4:
After playing around with the code for a while I managed to get it to run without errors, it can pick up knives until you are full, hops worlds to find a new knife, gos upstairs Lumby castle when full, and goes to access the bank. After it opens the bank it closes it then reopens it and tries to go up the stairs. my next goal is to make it deposit my items when the bank gets opened and instead of constantly going up- make it go down when it needs to go get more knives. I someone wants to explain how i can make my code switch to from case to case that would be cool, my best guess was to do return case BANK in the code but it always gives me red lines No errors this time, and here's my updated code:
http://pastebin.com/AKJVddEe