Jump to content

Script Not Starting - No error messages or anything :0


PlagueDoctor

Recommended Posts

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.) 

Link to comment
Share on other sites

​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
 

 

 

  • Like 3
Link to comment
Share on other sites

​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 :D, 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. 

  • Like 1
Link to comment
Share on other sites

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 by Acerd
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...