Prime - Amber Tweaks and Scripting API

Forum for alternative clients, mods & discussions on the same.
gigafunk
Posts: 23
Joined: Sat Apr 21, 2012 10:28 pm

Re: Prime - Amber Tweaks and Scripting API

Post by gigafunk »

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!
User avatar
Paradoxs
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Prime Update 0.3.2

Post by Paradoxs »

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
De_Luxe
Posts: 7
Joined: Mon May 19, 2014 9:26 pm

Re: Prime - Amber Tweaks and Scripting API

Post by De_Luxe »

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?
User avatar
Paradoxs
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Post by Paradoxs »

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");
De_Luxe
Posts: 7
Joined: Mon May 19, 2014 9:26 pm

Re: Prime - Amber Tweaks and Scripting API

Post by De_Luxe »

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?
iamahh
Posts: 1806
Joined: Sat Dec 12, 2015 8:23 pm

Re: Prime - Amber Tweaks and Scripting API

Post by iamahh »

getMapObjects could take an argument to sort by distance, name, etc...
User avatar
Paradoxs
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber Tweaks and Scripting API

Post by Paradoxs »

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
ae_maderero
Posts: 7
Joined: Fri Jan 13, 2017 4:48 pm

Re: Prime - Amber Tweaks and Scripting API

Post by ae_maderero »

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.
kacper022
Posts: 4
Joined: Fri Feb 24, 2012 6:38 pm

Re: Prime - Amber Tweaks and Scripting API

Post by kacper022 »

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);
ae_maderero
Posts: 7
Joined: Fri Jan 13, 2017 4:48 pm

Re: Prime - Amber Tweaks and Scripting API

Post by ae_maderero »

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;
}

Return to “The Wizards' Tower”