AntiCitizen Posted October 17, 2015 Share Posted October 17, 2015 Hey guys I'm working on my first script and have no experience with programming, but am willing to learn!I want to create a script that picks up items in the area and banks them at the nearest bank. An example being a script that picks up fish dropped at a fishing spot and banks them. Would using a machine state type function work? Such as WAIT, GATHER, BANK? Or is there another method that would work better. I'm working on how the script would identify and pick up the fish but I'm not sure I understand that process correctly. Also in the script how would I specify the item to be picked up? Does that work off of item ID or name? Are there any tricks to better searching through the API? Below is what I have right now, which I'm certain is wrong. Any help would be awesome!Thanks! import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "AntiCitizen", info = "Grabs fish, banks it in Edgeville.", name = "Fish Snatcher", version = 0, logo = "") public class main extends Script { @Override public void onStart() { log("Start by the fishing spot in Barbarian Village!"); } private enum State { BANK, GATHER, WAIT }; private State getState{} { getAll = objects.closest{"Raw salmon, Raw trout"); } 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted October 17, 2015 Share Posted October 17, 2015 (edited) you need a onLoop and you would need to create a switch-case for your getState() @Override public int onLoop() throws InterruptedException { switch(getState()){ case STEAL: break; case DROP: break; case WALK_STALL: break; case POCKET: break; } return random(250, 600); } this: State getState() { if(condition 1) return State.POCKET; } And look through the Inventory and GroundItems API they are helpful Example: GroundItem g = getGroundItems().closest(""); /** remember to null check **/ Edited October 17, 2015 by TheObserver Quote Link to comment Share on other sites More sharing options...