Sup guys.
For those of you who wants to write scripts for tasks automatization w/o recompiling or wants to have a simple way to write scripts (even if you don't know much about programming at all), I'd like to present the modified Amber client with JS scripting API.
All you need to do is download the client (or build it from sources if you wish) and place the script named "script.js" inside the root directory of the client's folder.
How does it look like?
To get the idea, you can take a look at the example script in my Scrifen repository on GitHub.
As you see, the client calls functions in your script when certain events occurs (including but not limited to `onLogin`, `onCharSelect`, `onGameLoaded`, `onCurioFound` etc).
You can also communicate with the client via the `game` object passed to the `onGameLoaded` hook (including but not limited to `studyCurio`, `getInvItems`, `goTo`, `transferItemsFrom`, `drink` etc).
How much this API can do?
Again, take a look at the example here. There are a lot of comments, incl. documentation (you can also view the generated JSDocs at http://80.220.243.128/Scrifen-JSDocs/ -- thanks to shubla).
For example, you can write a forager bot, drying frames / tanning tubs checker bot etc.
I need to do XXX, please add YYY function to your API
Feel free to write me about any ideas you have (either in this thread or PM).
There are a lot of custom solutions like this. My village has one, for example
Yep, I know. However, my solution is free, open-source, scriptable (you don't have to recompile the client to make a new script work) and easy-modifiable even for those who doesn't know much about programming and client's source code.
Moreover, what's wrong with having an additional option?
Client download link
Client's source code is available here ("feature/script-api" branch)
-
b0r3d0m
- Posts: 95
- Joined: Sun Sep 13, 2015 2:39 pm
Scrifen -- Hafen scripting API
Last edited by b0r3d0m on Tue Jun 07, 2016 6:42 am, edited 2 times in total.
-
ydex
- Posts: 747
- Joined: Mon Apr 11, 2011 4:08 pm
Re: Scrifen -- Hafen scripting API
if i change the nme Dandelion to, let's say, Blueberrie. Will it be able to pick blueberries or does it have to be curios?
bold
-
b0r3d0m
- Posts: 95
- Joined: Sun Sep 13, 2015 2:39 pm
Re: Scrifen -- Hafen scripting API
The `pickItem` function works for any pickable game object.ydex wrote:Will it be able to pick blueberries
However, you will not receive any notification about blueberries because the `onCurioFound` hook triggers for curios only. I will think about adding the correspoding event type then.
For now, you can check such items via the `getMapObjects` function.
-
ydex
- Posts: 747
- Joined: Mon Apr 11, 2011 4:08 pm
-
b0r3d0m
- Posts: 95
- Joined: Sun Sep 13, 2015 2:39 pm
Re: Scrifen -- Hafen scripting API
Yep.ydex wrote:Does it autopath when picking items with pickItems?
-
ydex
- Posts: 747
- Joined: Mon Apr 11, 2011 4:08 pm
-
Gloosx_inn
- Posts: 32
- Joined: Mon Jul 01, 2013 6:49 pm
-
b0r3d0m
- Posts: 95
- Joined: Sun Sep 13, 2015 2:39 pm
Re: Scrifen -- Hafen scripting API
Not at the moment. Will write them as soon as possible.Gloosx_inn wrote:Any JSDocs?
-
Zeler
- Posts: 1484
- Joined: Thu Apr 14, 2011 2:09 pm
Re: Scrifen -- Hafen scripting API
The robotlings rise again.
-
algorithm
- Posts: 218
- Joined: Thu Aug 13, 2015 2:17 pm
Re: Scrifen -- Hafen scripting API
How to read console input? for ex to stop script processing and run it again after a while?
algorithm wrote:Cape awarded?
jorb wrote:Oh, for sure. Delivery 2022.