Fostik, try add "closeFlower()" to your code.Fostik wrote: And btw, im very bad in coding, so there are some requests:
A way to differ meat.
Some way to exit flower menu(or how can i?)
-
kacper022
- Posts: 4
- Joined: Fri Feb 24, 2012 6:38 pm
Re: Prime - Amber Tweaks and Scripting API
-
ydex
- Posts: 747
- Joined: Mon Apr 11, 2011 4:08 pm
Re: Prime - Amber Tweaks and Scripting API
I would like to place stockpiles next to my beehive. something like
var coords=getCoords(beehive)-1;
placeStockpile("straw",coords) ;
but since placeStockpile and many other comands need coords in x,y format it doesnt seam to work?
Is there a way to get the x and y coords separatly?
var coords=getCoords(beehive)-1;
placeStockpile("straw",coords) ;
but since placeStockpile and many other comands need coords in x,y format it doesnt seam to work?
Is there a way to get the x and y coords separatly?
bold
-
Fostik
- Posts: 2513
- Joined: Tue Jul 05, 2011 4:08 pm
- Location: EU
Re: Prime - Amber Tweaks and Scripting API
ydex wrote:I would like to place stockpiles next to my beehive. something like
var coords=getCoords(beehive)-1;
placeStockpile("straw",coords) ;
but since placeStockpile and many other comands need coords in x,y format it doesnt seam to work?
Is there a way to get the x and y coords separatly?
Function getCoords() returns only player coords.
I prefer use getMapObjects() and filter then. But this is shit for script speed
So, placeStockpile() requires item, x and y, not object.
Try something like
Code: Select all
placeStockpile("straw",coords.Coords.x,coords.Coords.y) ;

Known as zunzon. Contact discord: zunzon.
My experience of market building in W13
My experience of market building in W13
-
foomanchu
- Posts: 121
- Joined: Wed Jun 29, 2011 6:13 am
Re: Prime - Amber Tweaks and Scripting API
you can just spar one of your alts if you want to play around with combat stuff script wiseParadoxs wrote:Not yet, I'll work on it, I still dont have a character thats combat safe to be able to stand still and collect data to mess with combat. and test combat controls. SInce iv been gone im pretty behind. Its a eventual goal thoughThedrah wrote:is there any support for combat? such as knowing openers of yourself and opponent
and the new fishing requires the use of clicking on a window, any chance for some help?
pretty much what i did
-
Thedrah
- Posts: 943
- Joined: Fri Apr 08, 2011 2:20 am
- Location: behind you
Re: Prime - Amber Tweaks and Scripting API
how am i suppose to stop a script? using the login.js to log in on a character but it's stuck in a loop that won't break.
as far as i can tell, i'm suppose to use 'exit();' to end at the next loop. it does not for me. i've been trying to debug it for an hour or so but login just keeps looping
with this script, it just keeps repeating 'damn' endlessly
(i took out my login info for security)
edit: not using the login script seems to work great, guess i can't be lazy with logging in now hehe
edit 2: #loadlib is finicky, has to be in the same folder to load and if it has a main function, it loops instead of the loading file. maybe i should instead put the basic functions like nearest object from list into the api.js to make it simple...
as far as i can tell, i'm suppose to use 'exit();' to end at the next loop. it does not for me. i've been trying to debug it for an hour or so but login just keeps looping
with this script, it just keeps repeating 'damn' endlessly
(i took out my login info for security)
Code: Select all
var LoginAttempts = 0;
var CharacterSelectAttempts = 0;
function main(){
CheckLogin();
CheckChar();
Checkgame();
print("damn");
exit();
}
function CheckLogin(){
if(getMenu("login")){
print("Attempting to login");
if(LoginAttempts < 10) {
if (login(Username, Password)) {
print("Logged in under: " + Username);
} else {
print("Failed to login(" + LoginAttempts + ")");
LoginAttempts += 1;
}
}else{
print("Failed to login, script terminating");
Exit();
}
}
}
function CheckChar(){
if(getMenu("char")){
print("Attempting to select character");
if(CharacterSelectAttempts < 10) {
if (selectCharacter(Character)) {
print("Selected Character: " + Character);
} else {
print("Could not find character " + Character + " (" + CharacterSelectAttempts + ")");
CharacterSelectAttempts += 1;
}
}else{
print("Failed to select " + Character);
print("Do they exist? Script terminating");
Exit();
}
}
}
function Checkgame(){
if(getMenu("game")){
print("found game!");
print("login script example finished!");
print("logging out");
logout();
print("Terminating Script");
exit();
}
}edit 2: #loadlib is finicky, has to be in the same folder to load and if it has a main function, it loops instead of the loading file. maybe i should instead put the basic functions like nearest object from list into the api.js to make it simple...
▲
▲ ▲
▲ ▲
-
Paradoxs
- Posts: 294
- Joined: Tue Aug 25, 2015 7:16 am
Re: Prime - Amber Tweaks and Scripting API
There's a big in the way I handle the login script, its on my to-do to redo before next release.Thedrah wrote: edit: not using the login script seems to work great, guess i can't be lazy with logging in now hehe
edit 2: #loadlib is finicky, has to be in the same folder to load and if it has a main function, it loops instead of the loading file. maybe i should instead put the basic functions like nearest object from list into the api.js to make it simple...
Loadlib is indeed a bit annoying to work with, its being reworked. When I tested it it worked with folders though.
You can't have a main function anywhere but once, this doesnt just apply to my API this applies in java, C++ ect. The main can only exit once for a reason. its the start of your script. this is not a bug.
I will be reworking load lib, but mostly making it conform more with javascript rather than the system we have now.
Not yet implemented by on its way next releasekacper022 wrote:How can I get free solts in inventory?
-
RedSkies
- Posts: 105
- Joined: Sat Dec 10, 2016 5:59 am
Re: Prime - Amber Tweaks and Scripting API
Hey - love it so far. Been making a couple basic scripts without too much trouble, except for one thing. I'm not sure if I'm using it wrong, but the sendChat() function doesn't seem to work for me.
I've tried a number of variations but none seem to work:
sendChat("text here");
sendChat("text here",Channel.Area);
sendChat("text here,Channel.Area,"Username");
as well as several others. Am I doing something wrong?
Thanks
I've tried a number of variations but none seem to work:
sendChat("text here");
sendChat("text here",Channel.Area);
sendChat("text here,Channel.Area,"Username");
as well as several others. Am I doing something wrong?
Thanks
jorb wrote:I hereby forbid you from using it.
-
Paradoxs
- Posts: 294
- Joined: Tue Aug 25, 2015 7:16 am
Re: Prime - Amber Tweaks and Scripting API
RedSkies wrote:Hey - love it so far. Been making a couple basic scripts without too much trouble, except for one thing. I'm not sure if I'm using it wrong, but the sendChat() function doesn't seem to work for me.
I've tried a number of variations but none seem to work:
sendChat("text here");
sendChat("text here",Channel.Area);
sendChat("text here,Channel.Area,"Username");
as well as several others. Am I doing something wrong?
Thanks
sendChat was renamed chat a while back
-
roskuwacz
- Posts: 138
- Joined: Sun Apr 10, 2011 2:33 pm
Re: Prime - Amber Tweaks and Scripting API
Is there a possibility to get into buildings? Function PfClick and click do not work well is any other option?
Also a function which will read from specific chat will be usefull.
Also a function which will read from specific chat will be usefull.
All great things are simple, and many can be expressed in single words: freedom, justice, honor, duty, mercy, hope. - Winston Churchill
-
RedSkies
- Posts: 105
- Joined: Sat Dec 10, 2016 5:59 am
Re: Prime - Amber Tweaks and Scripting API
Thanks a bunch! Is there somewhere these changes are documented? I've been using the GitHub readme you have linked on the front page.Paradoxs wrote:RedSkies wrote:Hey - love it so far. Been making a couple basic scripts without too much trouble, except for one thing. I'm not sure if I'm using it wrong, but the sendChat() function doesn't seem to work for me.
I've tried a number of variations but none seem to work:
sendChat("text here");
sendChat("text here",Channel.Area);
sendChat("text here,Channel.Area,"Username");
as well as several others. Am I doing something wrong?
Thanks
sendChat was renamed chat a while back
jorb wrote:I hereby forbid you from using it.