Prime - Amber Tweaks and Scripting API

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

Re: Prime - Amber Tweaks and Scripting API

Postby gigafunk » Sat Jan 07, 2017 5:45 pm

Awesome thanks for the reply.

I am barely scriptKiddy levels programmer lol, so I wasn't sure if I was missing something.

I plan to use this to finally script a few projects of my own and break away from the basic beginner programming tutorials. So Thanks so much for your work!
gigafunk
 
Posts: 23
Joined: Sat Apr 21, 2012 10:28 pm

Prime Update 0.3.2

Postby Paradoxs » Sat Jan 07, 2017 6:35 pm

Prime has been updated for World 10 (0.3.2)
Note: you need to update your client!

Fixes
    useItem
    Fixed a problem where useItem failed at certain cordinates


Added
    useItem
    useItem when used on an object now accepts true or false for shift, for things like mass transfers and such
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby De_Luxe » Tue Jan 10, 2017 7:58 am

Guys how i can put some stuff from my inventory to container? drop("spindlytaproot",Inventory.Player,Prime.Inventory) not working. Also i have problems with placeStockpile(); can you give me example of use?
De_Luxe
 
Posts: 7
Joined: Mon May 19, 2014 9:26 pm

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Tue Jan 10, 2017 11:29 am

De_Luxe wrote:Guys how i can put some stuff from my inventory to container? drop("spindlytaproot",Inventory.Player,Prime.Inventory) not working. Also i have problems with placeStockpile(); can you give me example of use?



Prime.Inventory is not a type of inventory Inventory holds all of the types of inventory
Prime..Inventory.Study
Pime.Inventory.Player
Prime.Inventory.Container


First off your mixing a few things:
if you havent set a #primeObject you should not be using Prime.Inventory, you should be using Inventory.Type

Drop takes 3 arguments the ItemName, the Source Inventory, and the Destination

Source inventory is the Inventory the item is located so
Inventory.Study
Inventory.Player


(Currently doesnt allow you to Drop from a container directly, though this is fixed in the next version

Destination is either an Inventory OR
if To is a string it defines an Inventory.Container if To is an Inventory it drops into that inventory


This means you need to define the container by the window name


So your code should be

Code: Select all
drop("spindlytaproot", Inventory.Player, "Crate");
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby De_Luxe » Wed Jan 11, 2017 4:21 am

Gtreat ty! But i have more questions: how i can getItems() only with they names? Like getItems(Name); and how i can get all Items from cupboard?
De_Luxe
 
Posts: 7
Joined: Mon May 19, 2014 9:26 pm

Re: Prime - Amber Tweaks and Scripting API

Postby iamahh » Wed Jan 11, 2017 3:20 pm

getMapObjects could take an argument to sort by distance, name, etc...
iamahh
 
Posts: 1810
Joined: Sat Dec 12, 2015 8:23 pm

Re: Prime - Amber Tweaks and Scripting API

Postby Paradoxs » Wed Jan 11, 2017 3:45 pm

iamahh wrote:getMapObjects could take an argument to sort by distance, name, etc...


already added for next version, sorts by distance, name, and id, including reverse orders
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Postby ae_maderero » Fri Jan 13, 2017 10:08 pm

How do you modify an object coordinate?

What I'm trying to archieve:
Code: Select all
var obj = getHighlightedMapObjects();
goTo(obj.Coords.x +10, obj.Coords.y +10);


But it does nothing. When I modify Character coords, it works.
ae_maderero
 
Posts: 7
Joined: Fri Jan 13, 2017 4:48 pm

Re: Prime - Amber Tweaks and Scripting API

Postby kacper022 » Fri Jan 13, 2017 11:14 pm

ae_maderero wrote:How do you modify an object coordinate?

What I'm trying to archieve:
Code: Select all
var obj = getHighlightedMapObjects();
goTo(obj.Coords.x +10, obj.Coords.y +10);


But it does nothing. When I modify Character coords, it works.



Try this:
Code: Select all
var obj = getHighlightedMapObjects();
goTo(obj.x+10, obj.y+10);
kacper022
 
Posts: 4
Joined: Fri Feb 24, 2012 6:38 pm

Re: Prime - Amber Tweaks and Scripting API

Postby ae_maderero » Fri Jan 13, 2017 11:53 pm

kacper022 wrote:Try this:
Code: Select all
var obj = getHighlightedMapObjects();
goTo(obj.x+10, obj.y+10);


Nothing. Not even without modifying the coords. The weird thing is pfClick(object) does work.

Actual code:
Code: Select all
function main() {
        var ZonaDescarga = askFor('Selecciona con Alt+Click el punto de descarga de los materiales');
        goTo(ZonaDescarga.x, ZonaDescarga.y);
        waitForPf();   
   exit();
}

function askFor(msg, who) {
   var channel = (who != undefined) ? Channel.Private : undefined;
   chat(msg, channel, who);
   var object = undefined;
   while (object == undefined){
      var element = getHighlightedMapObjects();
      if (element[0] !== undefined)
         object = element[0]
      sleep(100);
   }
   chat('Objeto obtenido', channel, who);
   sleep(1000);
   return object;
}
ae_maderero
 
Posts: 7
Joined: Fri Jan 13, 2017 4:48 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Claude [Bot] and 49 guests