Jester87's Bot Tutorial For Newbies

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Re: Jester87's Bot Tutorial For Newbies

Postby Jester87 » Wed Jan 18, 2012 8:37 pm

I added a log collector bot to help clean up. It's incomplete, but you can manually change the direction in which it collections as suggested in the description.
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: Jester87's Bot Tutorial For Newbies

Postby danvath » Thu Jan 19, 2012 3:29 am

Still working on it, but it sounds like we need to have a fail safe for when pathfinder = null, so if pathfinder = null then make the character move by clicking on the edge of the screen to move there, then check for trees again. This way it keeps looking around until it finds one.

Do you know what happens when the memory leak takes effect? The memory leak may just be the fact that pathfinder = null so it keeps running the script to look for a tree, but fails and starts looking again and again.
danvath
 
Posts: 84
Joined: Fri Nov 26, 2010 2:05 am

Re: Jester87's Bot Tutorial For Newbies

Postby Jester87 » Thu Jan 19, 2012 4:42 am

danvath wrote:Still working on it, but it sounds like we need to have a fail safe for when pathfinder = null, so if pathfinder = null then make the character move by clicking on the edge of the screen to move there, then check for trees again. This way it keeps looking around until it finds one.

Do you know what happens when the memory leak takes effect? The memory leak may just be the fact that pathfinder = null so it keeps running the script to look for a tree, but fails and starts looking again and again.


Yeah, I thought about that being a possible solution. I just haven't had the time to play around with it yet.

As for the memory leak, that is a good theory, but I have no way of testing it for sure. I also am not a programmer, so I don't know how one would even go about fixing memory leaks.
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: Jester87's Bot Tutorial For Newbies

Postby danvath » Thu Jan 19, 2012 4:51 am

Usually a memory leak is some part of the code that is getting called in a never ending loop. Each time it is called it takes up some of the memory address. So say you had

if(i !< 4)

but i never has the ability to ever get below 4, then you have a memory leak because it will continusly run without termination.
Another thing that can cause this is from resources not being cleared after they are gone. I think C# and Java both have their own garbage collection so it should not happen in these bots.

How do you know that there is even a memory leak in the first place?

First time actually loading up this client, and see that I have 15FPS...
danvath
 
Posts: 84
Joined: Fri Nov 26, 2010 2:05 am

Re: Jester87's Bot Tutorial For Newbies

Postby Jester87 » Thu Jan 19, 2012 5:19 am

danvath wrote:Usually a memory leak is some part of the code that is getting called in a never ending loop. Each time it is called it takes up some of the memory address. So say you had

if(i !< 4)

but i never has the ability to ever get below 4, then you have a memory leak because it will continusly run without termination.
Another thing that can cause this is from resources not being cleared after they are gone. I think C# and Java both have their own garbage collection so it should not happen in these bots.

How do you know that there is even a memory leak in the first place?

First time actually loading up this client, and see that I have 15FPS...


I am fairly certain there is a memory leak because it starts at 500mb and ends above 1 GB. I've also received the out of memory error which shouldn't happen for a game like this.

As for your 15FPS, no idea on that. Do you have the latest version of Java?
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: Jester87's Bot Tutorial For Newbies

Postby mvgulik » Thu Jan 19, 2012 11:21 am

danvath wrote:Usually a memory leak is some part of the code that is getting called in a never ending loop.

Erm. The loop part only make a memory leak nicely detectable.
Memory leak: Something or some action is using some resources that are never released again. (this can be anything, from bug in internal Client or Groovy base code to bad user groovy coding ... like (example) constantly opening a file whiteout ever closing it/them.)
mvgulik
 
Posts: 3753
Joined: Fri May 21, 2010 2:29 am

Re: Jester87's Bot Tutorial For Newbies

Postby ashwolf » Thu Jan 19, 2012 9:34 pm

I saved the chop and collect files as: chop.groovy and collect.groovy
Now the problem is when I typ :bot chop or :bot collect it does nothing at all. What am I doing wrong?
All it says is immediately 'script FINISHED'
:?:
ashwolf
 
Posts: 6
Joined: Thu Jan 19, 2012 9:32 pm

Re: Jester87's Bot Tutorial For Newbies

Postby Jester87 » Fri Jan 20, 2012 12:46 am

ashwolf wrote:I saved the chop and collect files as: chop.groovy and collect.groovy
Now the problem is when I typ :bot chop or :bot collect it does nothing at all. What am I doing wrong?
All it says is immediately 'script FINISHED'
:?:


Can you post a screenshot of your dos console screen? It usually will help shed light on whats going wrong.
User avatar
Jester87
 
Posts: 195
Joined: Mon Dec 12, 2011 8:19 am
Location: Hell

Re: Jester87's Bot Tutorial For Newbies

Postby danvath » Fri Jan 20, 2012 4:47 pm

mvgulik wrote:
danvath wrote:Usually a memory leak is some part of the code that is getting called in a never ending loop.

Erm. The loop part only make a memory leak nicely detectable.
Memory leak: Something or some action is using some resources that are never released again. (this can be anything, from bug in internal Client or Groovy base code to bad user groovy coding ... like (example) constantly opening a file whiteout ever closing it/them.)


Thats what leads me to think that the memory leak is comeing from the fact that when it can not find anymore trees, it just sits there and continusly searchs over and over extremely fast. There is no fail safe to say:

When you've searched 10 times and found no trees;
break;

To get the code to go to the end and terminate, instead of continusly using resources to try and find non-existant trees until the script is terminated. Which it will never do until the player hits F3 at this point.
danvath
 
Posts: 84
Joined: Fri Nov 26, 2010 2:05 am

Re: Jester87's Bot Tutorial For Newbies

Postby BangPow » Mon Jan 23, 2012 10:37 am

Anything new going on with the scripts guys?
Before enlightenment - chop wood, carry water. After enlightenment - chop wood, carry water. ~Zen Buddhist Proverb
User avatar
BangPow
 
Posts: 427
Joined: Tue May 31, 2011 4:15 am
Location: Now.......... Awakened

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Yandex [Bot] and 3 guests