Prime - Amber Tweaks and Scripting API

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

Re: Prime - Amber Tweaks and Scripting API

Postby LostJustice » Sun Dec 25, 2016 5:52 am

Also how do I right click aka to place something such as a log?
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Sun Dec 25, 2016 6:47 am

LostJustice wrote:Also how do I right click aka to place something such as a log?


Currently thats out of scope for the API I'll see if I can do it tomorrow, but I might be too busy with family. We'll see, I should have time to at least look through the code
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby LostJustice » Mon Dec 26, 2016 2:02 am

Paradoxs wrote:
LostJustice wrote:Also how do I right click aka to place something such as a log?


Currently thats out of scope for the API I'll see if I can do it tomorrow, but I might be too busy with family. We'll see, I should have time to at least look through the code


With the original clicking I could do it, mainly what is needed is the ability to right and left click at certain coordinates x,y. Also being able to access inventories such as chests and containers is needed as well.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Mon Dec 26, 2016 2:48 am

LostJustice wrote:With the original clicking I could do it, mainly what is needed is the ability to right and left click at certain coordinates x,y. Also being able to access inventories such as chests and containers is needed as well.


The clicking is going to be looked at next on the list

Inventory object was originally put into API and removed due to limited functionality, Its on the list after the clicking, both im going to flesh out before the next update.

Right now Im doing some changes to amber, and re-coding a bulk of the options window which is taking a large chunk of time. I have i think around 10-15 function additions or api changes / additions, some are generic bridges that while not super friendly will at least give functionality in places the api doesnt offer a direct and simple solution
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby Thedrah » Wed Dec 28, 2016 6:16 pm

i would like to put in a suggestion to drag the mouse. for farming
and how do i put an item from inventory into my hand?
  ▲
▲ ▲
Thedrah
 
Posts: 936
Joined: Fri Apr 08, 2011 2:20 am
Location: behind you

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Thu Dec 29, 2016 2:43 am

Dragging of the mouse is somthing I will add to the list, it is however a feature that I feel is negated with an array and is not going to be looked at until more prioritized features and changes are finished.

Inventory management and access is one of those things, currently it is not possible to put or get something from hand, this is being looked at for the next release

The new options menu has been put on hold for more dire features.

The API underwent a long and slow upgrade recently for the sake of more user control, the script-api remains the same, primes implementation of it was slightly altered.

A foundation for multi-scripts has been laid but wont see the light of day in the next release, but its on the list

development continues but is slow in area where I have to re-write most of my previous work for the sake of debugging and adding features. Primes current setup should be one I don't touch for a long time, but this is never a guaranteed case.
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby mentokeep » Wed Jan 04, 2017 5:37 am

Some reports from linux :)

Code: Select all
➭ ./run.sh       
zsh: ./run.sh: bad interpreter: /bin/bash^M: no such file or directory


seems like bad line ending, replaced this file from amber release (with normal \n on line end) and all goes fine.

One more thing: if scripts folder name like in release archive -- on linux no scripts is seen inside client, but if rename to Scripts (with frist uppercase S) -- scripts apears in client. I think on windows no differences on filepaths and scripts dir name also works fine, but not on unix-capable.
mentokeep
 
Posts: 3
Joined: Mon Dec 19, 2016 10:11 pm

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Wed Jan 04, 2017 5:40 am

mentokeep wrote:Some reports from linux :)

One more thing: if scripts folder name like in release archive -- on linux no scripts is seen inside client, but if rename to Scripts (with frist uppercase S) -- scripts apears in client. I think on windows no differences on filepaths and scripts dir name also works fine, but not on unix-capable.


I noticed this too and its been fixed for the latest release (which will be uploaded within an hour)

As far as your issues with run.sh, its odd because I simply put an amber release file in it, so there shouldn't be a difference. I'll grab a new one to see if that fixes it
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Prime Update 0.3

Postby Paradoxs » Wed Jan 04, 2017 7:38 am

Version 0.3 Notes
Notice: 0.3 Changes the implementation of the API we now use a API.js file externally for future feature upgrades and for faster development turnaround among a host of other bonuses to this setup. Get the API Here! Updates to the API will happen on this repository. A new prime version will still be announced even in the event of a purely Script API update to allow users to grab a known stable API client Combo
JSDocs are half way complete, and will be complete within a day



Fixes

    liftItem
    liftItem no longer requires line-of-sight and will pathfind to the object as was intended

    Falsify
    All functions return false on detecting a failure. making function checks as simple as if(!Function()) return false;

    Item Coords
    Item Coords no longer always equal (0,0) they will now list the column and row of the inventory they are in



New Features

    #primeObject(Name)
    #primeObject(Name) has been added. You can use it to bind all functions to an object so for example
    Code: Select all
    #primeObject(Game);
    Game.print("Emulates the old Game variable");

    #events(true or false)
    #events(boolean) has been added. Events have been depreciated. To turn them on pass true
    Code: Select all
    #events(true);

    #loadLib(Filename)
    #loadLib(Filename) has been Changed. It now uses a # to denote it as a flag, and no longer needs quotes. Files are also found by relative path as was always intended
    Code: Select all
    #loadLib(test.js);


Changes to reserved Variables and Functions

Prime can now be bound to an object, making no functions or variables global scope if desired

New Prime Interfaces

These are objects that prime will return and how you can use them
    Stockpile
    Stockpile has three properties Current, Max and Name
    Code: Select all
    print(getStockpile());

Changed Functions

    hasItem(ItemName, Inventory, Title)
    Works as before, accepting a Prime.Inventory for specific inventories and a Title for container inventories

    getItem(ItemName, Inventory, Title)
    Works as before, accepting a Prime.Inventory for specific inventories and a Title for container inventories

    getItems(Inventory, ItemName, Title)
    Works as before, accepting a Prime.Inventory for specific inventories and a Title for container inventories. Current implementation requires an item for container inventories. Will be modified for next release

    drop(ItemName, Inventory, To)
    Replaced dropTo, drops an item in inventory to the ground or the specified To. To specify a container simply pass the name to To specify a inventory such as Inventory.Player just pass the Prime.Inventory to To

    useActionMenu(Hotkeys)
    Hotkeys can be a single string "ahl" or an array of string ["a", "h", "l"]

    liftItem(Item)
    Renamed liftObject to match theme. Now pathfinds to the object before lifting, as was originally intended.

    login(Name, Password)
    Now does its own menu checks

    selectCharacter(Name)
    Now does its own menu checks

    exit()
    Renamed to be lowercase to match all other functions



NewFunctions

    take(ItemName, Inventory, Title)
    Grabs the item from a specified inventory. Title is used to specify a container if a container is desired. If no inventory is specified it assumes Inventory.Player

    hasHand(Item)
    Accepts an optional ItemName, returns true if it has Item, if no Item is specified returns true if any item is held

    getHand()
    Returns the item in hand if it exists, else returns false;

    useItem(X, Y)
    Accepts X and Y if Coordinates; Accepts X as a MapObject if object is desired. Preforms a right click with the item in hand on an object, for filling buckets for example.

    placeStockpile(Item, X, Y)
    Attempts to place a stockpile of Item at X and Y. If there is an item in hand it will ignore the Item string.

    getStockpile()
    Grabs an open Stockpile windows information see new interface Stockpile

    takeStockpile
    Transfers all it can from an open stockpile window

    click(X, Y, Button, Shift)
    preforms a click at X, Y. The rest of the behavior is like pfClick. it does no pathfinding and is useful in situations where you want to, for example place an object after lifting it.
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby mentokeep » Wed Jan 04, 2017 3:40 pm

Paradoxs wrote:
mentokeep wrote:Some reports from linux :)

One more thing: if scripts folder name like in release archive -- on linux no scripts is seen inside client, but if rename to Scripts (with frist uppercase S) -- scripts apears in client. I think on windows no differences on filepaths and scripts dir name also works fine, but not on unix-capable.


I noticed this too and its been fixed for the latest release (which will be uploaded within an hour)

As far as your issues with run.sh, its odd because I simply put an amber release file in it, so there shouldn't be a difference. I'll grab a new one to see if that fixes it


Still broken run.sh file. In release 0.3 of prime its 117 bytes (like before), in amber release its 115 bytes. You can see diff -u for this two files btw.
mentokeep
 
Posts: 3
Joined: Mon Dec 19, 2016 10:11 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Bytespider [Bot], Claude [Bot] and 137 guests