Jump to content

limited to 1 local script?


Recommended Posts

Posted

this was driving me nuts lol, i could not get the bot to find my script, until i figured out it only allows up to 1 local script, so i just deleted the other jar i had in there

It has to do something with the scripts' core. if the mainclass in a script is called main.java and in a second script the mainclass is called the same --> one of those two will only appear.

Posted

this is off topic but i also have another question and i dont want to make another topic, 

are references to entities still valid after the entity changes (ie. when you chop down a tree and becomes a tree stump that entity changes) , so basically if i could still interact with the same tree instance after it respawns

As long as you're calling them by String (entity name), then yes, after respawn your interaction will still work :). Just make sure you use a null check else if you cut them all down problems shall arise.

Posted

As long as you're calling them by String (entity name), then yes, after respawn your interaction will still work smile.png. Just make sure you use a null check else if you cut them all down problems shall arise.

if i instantiate it like so

 

ent= getObjects().closest(new Area(...,tree id);

 

and it is not null, i chop it, it respawns, will this still be valid

Posted

if i instantiate it like so

 

ent= getObjects().closest(new Area(...,tree id);

 

and it is not null, i chop it, it respawns, will this still be valid

That's correct, this is the entity declaration I use in my Willow Cutter:

	Entity tree = objects.closest("Willow");

It seems to work perfectly fine with respawned trees. I'd highly advise you avoid using the trees ID's as they're prone to changing on the fly, especially after updates.

  • Like 1
Posted

That's correct, this is the entity declaration I use in my Willow Cutter:

Entity tree = objects.closest("Willow");
It seems to work perfectly fine with respawned trees. I'd highly advise you avoid using the trees ID's as they're prone to changing on the fly, especially after updates.
Im still pretty new when it comes to osbot scripts ( and rs bots in general) but I'll definitely keep that in mind

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