PlagueDoctor Posted October 26, 2016 Share Posted October 26, 2016 This may be more suited to be in 'Scripting Help', but i'm unsure whether or not this is a problem with my script or a problem with the client interacting with my script or.. whatever. I've recently finished writing a very basic draft of a shop buying script. I'm trying to test it out but its not starting at all and i'm getting nothing in the logger. I start my bot, press play, refresh, select my script and click start and nothing happens.. also nothing shows up in the logger past the acknowledgement that I've started my bot. All my other scripts work. I've read through the code heaps of times to see whether or not I've missed something obvious and important.. but i haven't had any luck so far. Here's the code, this is all it is at this point http://pastebin.com/jNHhm0Uh , perhaps someone with more experienced eyes than mine can see what the issue is :> I'm at a bit of a loss due to the lack of error messages or anything.. no idea whats going on. Thanks to anyone who decides to have a look. (I've only recently started writing code, hopefully its not too hard on the eyes.) Quote Link to comment Share on other sites More sharing options...
Alek Posted October 27, 2016 Share Posted October 27, 2016 I see in your onPaint you have a fancy but useless mouse paint. How about adding a functional output which displays your current state? This way you can at least see which state it's stuck on. Some additional tips: Worry about making a properly functioning script, that will save you from more bans than bullshit tinfoil logic. If you are interested why, look into linear regression. It's something you will learn if you take a Statistics course in High School/University. return random(600, 800); //The amount of time in milliseconds before the loop is called again Use Java conventions for your brackets. if(conditional) { //Code here } Not: if(conditional) { //code here } This doesn't execute: new ConditionalSleep(20000, 25000) { ConditionalSleep(timeout, recheck)Should be something like (20000,1000). The one parameter form does a recheck every 50ms. Edit: Hid your old topic 3 Quote Link to comment Share on other sites More sharing options...
PlagueDoctor Posted October 27, 2016 Author Share Posted October 27, 2016 I see in your onPaint you have a fancy but useless mouse paint. How about adding a functional output which displays your current state? This way you can at least see which state it's stuck on. Some additional tips: Worry about making a properly functioning script, that will save you from more bans than bullshit tinfoil logic. If you are interested why, look into linear regression. It's something you will learn if you take a Statistics course in High School/University. Use Java conventions for your brackets. if(conditional) { //Code here } Not: if(conditional) { //code here } This doesn't execute: new ConditionalSleep(20000, 25000) { ConditionalSleep(timeout, recheck) Should be something like (20000,1000). The one parameter form does a recheck every 50ms. Edit: Hid your old topic Thanks, apologies for posting in the wrong place originally. Hadn't slept yet at the time. Thanks for the tips, i recently read up on the java conventions, still transitioning from bad old habits. Also reading up on linear regression now. Found out the reason my script wasn't starting at all ( i was able to reproduce it later ). It was due to poor placement of variables, one of the time i was able to reproduce it was when i placed a RS2WIdget variable at the top of my code. This apparently causes OSBot to not want to execute the script. So , problem solved and the way to solve it is to properly place certain variables. This is the state of the script currently - hhttp://pastebin.com/Z8LWniQH - anymore tips from anyone is greatly welcomed. 1 Quote Link to comment Share on other sites More sharing options...
Acerd Posted October 27, 2016 Share Posted October 27, 2016 (edited) NPC Store = npcs.closest("Magic Store owner"); is causing it. initialize it when you need to in onLoop(). like this: NPC store; public int onLoop() { if (needToInteractWithStore) { store = npc.closest("Name"); if (store != null && store.interact("action")) { // conditional sleep till widget or interface is open/not null } } return 69; } Edited October 27, 2016 by Acerd Quote Link to comment Share on other sites More sharing options...