Scrifen -- Hafen scripting API

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

Re: Scrifen -- Hafen scripting API

Postby Glorthan » Tue Jun 14, 2016 6:21 pm

Try putting a sleep after the right click to wait for the flower option. I had an issue with my script when the sleep was too short at that point and the server was laggy. 1000ms will be more than enough.

As in it takes a little bit of time after right clicking the object for the flower menu to appear - which is probably causing the flower menu selection to fail every time.
Glorthan
 
Posts: 1099
Joined: Tue Jun 11, 2013 4:33 pm

Re: Scrifen -- Hafen scripting API

Postby UzU123 » Tue Jun 14, 2016 6:48 pm

Ok so I've added sleep after right click but still it doesn't work. Whenever I put 'pepper' after getMapObjects bot only walks forward to LC, opens it and closes it. But after I put 'trellis' after getMapObjects bot walks to the trellis but after few secs it comes back to LC and does it again. So I think it is impossible to harvest from trellis cause I have to click right click on pepper not trellis to harvest it. Maybe there must have be another function added by b0r3d0m to API for harvesting from trellis?
UzU123
 
Posts: 15
Joined: Mon Dec 31, 2012 7:00 pm

Re: Scrifen -- Hafen scripting API

Postby Glorthan » Tue Jun 14, 2016 7:28 pm

Yeah i had a look seems to be a bug that doesn't let trellis crops be interacted with via right click, unlike most other objects.
Glorthan
 
Posts: 1099
Joined: Tue Jun 11, 2013 4:33 pm

Re: Scrifen -- Hafen scripting API

Postby LostJustice » Wed Jun 15, 2016 1:55 am

Glorthan wrote:Yeah i had a look seems to be a bug that doesn't let trellis crops be interacted with via right click, unlike most other objects.


I have been having the same issue because of the differences between right and left clicking is properly defined yet in the Game.java code of the API (I Checked).

As for my progress though, I hate using the listeners that this system had set up and instead created my own asynchronous thread that queues the jobs in order as they are needed and as the bot decides. Because another issue is that the script tends to over jump lines in order to keep up with processing time (often time skipping the listeners when they are needed) since javascript is essentially a very weak version of java meant to be deployed on webpages, not for scripts for bots.

Essentially just create a new asynchronous thread for your bot and make sure the actions are queued in proper order rather than time otherwise important actions in your logic may not be executed. If you are unsure how to do this, I am posting my script below and note this is my current script and not everything works clearly yet but majority of stuff like the tree chopper which you can easily translate to a harvester does work. I also have a github posted with the updated version of my current build and tools at: https://github.com/DaschnerJ/HearthLabs

Code: http://pastebin.com/PER0T92Z
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Scrifen -- Hafen scripting API

Postby APXEOLOG » Wed Jun 15, 2016 6:43 am

LostJustice wrote:since javascript is essentially a very weak version of java meant to be deployed on webpages, not for scripts for bots.

You are totally wrong :)
W10 Meme Plot | W9 Mantis Garden | W8 Core | W7 Ofir | W6 the City of Dis | W5 Vitterstad | W4 A.D. | W3 Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.
User avatar
APXEOLOG
 
Posts: 1267
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Scrifen -- Hafen scripting API

Postby LostJustice » Wed Jun 15, 2016 10:26 am

APXEOLOG wrote:
LostJustice wrote:since javascript is essentially a very weak version of java meant to be deployed on webpages, not for scripts for bots.

You are totally wrong :)


http://www.crockford.com/javascript/javascript.html
https://en.wikipedia.org/wiki/JavaScript

Being a computer science major, I do have to agree with both these sources as this is what my books tell me. Javascript was originally Livescript meant to be deployed with CSS and HTML. It does not contain classes or information hiding which is a huge issue in OOP languages and doesn't truly have classes which is a big aspect of Java and inheritance. So I have to say based on the sources, my books, and education that I disagree and still think JavaScript is weaker than Java and was meant to work along side CSS and HTML web page development. Now there may be instances such as this where Javascript is used for bots and AI which is understandable but personally I believe using a star screw driver on a star screw head is a lot easier and better suited than using a flat head on a star head screw.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Scrifen -- Hafen scripting API

Postby Glorthan » Wed Jun 15, 2016 2:26 pm

LostJustice wrote:It does not contain classes or information hiding which is a huge issue in OOP languages and doesn't truly have classes which is a big aspect of Java and inheritance.

Why the fuck would you 'need' classes and inheritance in a botting script? Free functions make a lot more sense, unless you think that having singletons for every class is good design :roll:.

Sounds like (as with many comp sci courses) you just learned to do everything The Java Way™ without actually learning different paradigms like procedural, functional, etc and how and why they can be useful, rather than just trying to shoehorn every aspect of every problem into an (often suboptimal) OOP design. It's a common misconception I see a lot in uni undergrads and even some grads that started with and mostly stuck to java in their courses.
Glorthan
 
Posts: 1099
Joined: Tue Jun 11, 2013 4:33 pm

Re: Scrifen -- Hafen scripting API

Postby algorithm » Wed Jun 15, 2016 4:03 pm

LostJustice wrote:since javascript is essentially a very weak version of java meant to be deployed on webpages, not for scripts for bots.


The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. It seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language.

:o You are totally wrong man... stop this...

And yes, mr.
LostJustice wrote:computer science major
learn different paradigms. And few ways to do better code than if() else if() else if()...(hint: maps)
algorithm wrote:Cape awarded? ;)

jorb wrote:Oh, for sure. Delivery 2022. ;)
algorithm
 
Posts: 216
Joined: Thu Aug 13, 2015 2:17 pm

Re: Scrifen -- Hafen scripting API

Postby LostJustice » Wed Jun 15, 2016 6:15 pm

Glorthan wrote:
LostJustice wrote:It does not contain classes or information hiding which is a huge issue in OOP languages and doesn't truly have classes which is a big aspect of Java and inheritance.

Why the fuck would you 'need' classes and inheritance in a botting script? Free functions make a lot more sense, unless you think that having singletons for every class is good design :roll:.

Sounds like (as with many comp sci courses) you just learned to do everything The Java Way™ without actually learning different paradigms like procedural, functional, etc and how and why they can be useful, rather than just trying to shoehorn every aspect of every problem into an (often suboptimal) OOP design. It's a common misconception I see a lot in uni undergrads and even some grads that started with and mostly stuck to java in their courses.


Try to make a complex program, aka bot AI. See how difficult it becomes when you have a multiple set of variables and different bots for different tasks, especially when there is a large number of possible types of bots.

Edit: Also on a side note, I do actually code each bot of a more one class one bot method. It maintains organization and allows other users to input and change code as needed and basically more flexibility. I have a stitcher jar that takes all the bots scripts, utilities scripts, and ect and combines them into the required final script for run time. On top of that, you do not learn "The Java Way", please go to college and maybe finish your high school GED before even trying to make that argument otherwise you just are making an irrelevant argument.
Last edited by LostJustice on Wed Jun 15, 2016 6:25 pm, edited 1 time in total.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Scrifen -- Hafen scripting API

Postby LostJustice » Wed Jun 15, 2016 6:17 pm

algorithm wrote:
LostJustice wrote:since javascript is essentially a very weak version of java meant to be deployed on webpages, not for scripts for bots.


The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. It seems that the name was intentionally selected to create confusion, and from confusion comes misunderstanding. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language.

:o You are totally wrong man... stop this...

And yes, mr.
LostJustice wrote:computer science major
learn different paradigms. And few ways to do better code than if() else if() else if()...(hint: maps)


Note I never said they were the same language or created by the same company. In fact, I said it was created by netscape and originally called livescript. Now, the if else if else was actually coded from my partner who is learning coding. Personally I do not like to code like that unless it needed. Understand that I have more than one person working on this project and everyone has different levels of their abilities to program. So please sir, you managed to read some of the article yet you also need to learn forum posts. Thank you and good day.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

PreviousNext

Return to The Wizards' Tower

Who is online

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