Prime - Amber Tweaks and Scripting API

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

Re: Prime - Amber tweaks and Scripting API

Postby iamahh » Tue Dec 20, 2016 3:18 pm

once the API is flexed out, a possible expansion is creating and managing in-game interface... like Greasemonkey... one could use the API to create a small window with buttons and catch events and display some text there, possibly with images contained in the script directory... making it powerful enough to create a macro recorder could be a good reference point... of course this is an extreme suggestion :mrgreen:
iamahh
 
Posts: 1810
Joined: Sat Dec 12, 2015 8:23 pm

Re: Prime - Amber tweaks and Scripting API

Postby Kaios » Tue Dec 20, 2016 5:16 pm

gay
User avatar
Kaios
 
Posts: 9171
Joined: Fri Jul 30, 2010 2:14 am

Re: Prime - Amber tweaks and Scripting API

Postby LostJustice » Tue Dec 20, 2016 5:26 pm

Could you also put the list of events that can be called on the readme?
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber tweaks and Scripting API

Postby wafflecat » Tue Dec 20, 2016 5:31 pm

Kaios wrote:gay

I dunno. I honestly despise botting when it's done to automate all the tasks, pretty much letting the computer play the game by itself.
But when it comes to brainless manual activities like mining or flattening ground, I don't see an issue and many others who use custom clients don't.
So when I can use this to automate similar things like wood chopping for example, I really don't see an issue. I've got like 200 trees to chop. Why is it OK to automate flattening a 100x100 area but not chop trees in that area?

I mean, again, I hate botting. But this just seems to make sense to me, done on this scale.
Extremism depends on the measure. If you can't stop yourself at a certain level and create a whole village ran by bots, to me it's just like not leaving your religion in the mosque and blowing shit up. Or whatever. Is this too literal?
User avatar
wafflecat
 
Posts: 260
Joined: Thu Dec 15, 2011 7:46 pm

Re: Prime - Amber tweaks and Scripting API

Postby Kaios » Tue Dec 20, 2016 5:39 pm

wafflecat wrote:I dunno. I honestly despise botting when it's done to automate all the tasks, pretty much letting the computer play the game by itself.


That's what this client looks like to me

But when it comes to brainless manual activities like mining or flattening ground, I don't see an issue and many others who use custom clients don't.


I don't have a problem with that either but mining and leveling are both activities that require you to be constantly active as in dropping things from your inventory, picking them up, moving the character, etc. and it really is not fun to do this type of activity manually so I do see the need for it. I just wish the devs would simply put those features in to the default client though, I should be able to shift click an area to mine the same way it is done with farming.

So when I can use this to automate similar things like wood chopping for example, I really don't see an issue. I've got like 200 trees to chop. Why is it OK to automate flattening a 100x100 area but not chop trees in that area?


Chopping trees really does not require too much input, not as much as mining or leveling but it's another incredibly boring activity so I do understand why you'd want something for that too. I don't see the need for it personally and it appears as laziness to me or a lack of interest in the game's activities but like I said I do agree such activities are not fun to do manually.
User avatar
Kaios
 
Posts: 9171
Joined: Fri Jul 30, 2010 2:14 am

Re: Prime - Amber tweaks and Scripting API

Postby iamahh » Tue Dec 20, 2016 5:58 pm

AI is not that easy to do, people can automate simple repetitive task but beyond that it's probably easier to just play the game most of the time
iamahh
 
Posts: 1810
Joined: Sat Dec 12, 2015 8:23 pm

Re: Prime - Amber tweaks and Scripting API

Postby Paradoxs » Tue Dec 20, 2016 8:47 pm

As with any discussion around botting, lets not form arguments on whether its the right thing to do or not. You can have your opinion, but this isnt a discussion on our opinions.

LostJustice wrote:Could you also put the list of events that can be called on the readme?

I can do that here in the next hour or two, We are nearing the next release today as well.

One thing to note though is Im thinking of removing events, and replacing them with functions that do similar roles, such as checkForCuriosities(); or somthing
The big flaw with the event system is that events do not call until the next iteration of the main loop() so if I am sleeping in the loop, its possible for someone to walk up and kill me.

I have a few ideas on how to fix this, but I wont be experimenting on it till the after my current build is pushed.

Glorthan wrote:A getPing() accessor function might be nice to handle this issue more dynamically - previously I had to have large margins of error to prevent my bots from failing whenever the server was lagging, but it made them far less efficient at repetitive tasks, eg. farming.


I'll look into doing somthing like that for sure!


Regarding comparing map objects
The problem comes with how javascript compares arrays. In the current build if i compare two lists they are always false likewise
Code: Select all
var Example = [1,2,3];
var Duplicate = [1,2,3];
print(Example==Duplicate);


Will also always return false. Prime makes it a step more difficult by then having the actual objects separate object instances and that also always equals false. It comes from the fact that its returning an array of job objects, so its trying to compare objects that it has no concept of.

I am currently in the process of fixing this. The next version I will likely have a quick hack function "check(x,y)" that should be able to tell you if a list or a specific map object is the same as another, but if I can make a better solution in the next few hours I will.


A few API changes are occurring, functions have been renamed, and removed, and added.

Renamed functions are now short, we inherited some longwords from Scrifen, but Iv finished re-writing the class from the ground up, so we've lost that as a result.

Some functions are gone completely. They were either condensed multiple into one or re-wrote to the point that they dont work exactly the same so I simply removed them and kept the new versions
Last edited by Paradoxs on Tue Dec 20, 2016 9:15 pm, edited 1 time in total.
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber tweaks and Scripting API

Postby wafflecat » Tue Dec 20, 2016 9:10 pm

Any word on this issue, Paradoxs?
wafflecat wrote:I don't know if it's intended but using Game.mapObjectRightClick leaves the flower menu open, even after using Game.chooseFlowerMenuOption.
It interrupts when trying to do actions after it.
User avatar
wafflecat
 
Posts: 260
Joined: Thu Dec 15, 2011 7:46 pm

Re: Prime - Amber tweaks and Scripting API

Postby Paradoxs » Tue Dec 20, 2016 9:17 pm

wafflecat wrote:Any word on this issue, Paradoxs?
wafflecat wrote:I don't know if it's intended but using Game.mapObjectRightClick leaves the flower menu open, even after using Game.chooseFlowerMenuOption.
It interrupts when trying to do actions after it.


Thats a timing issue, it calls to choose the menu before the menu has actually been made available. If you put a sleep(1000); for a one second delay with no lag it will choose and close.

I'll be implementing some kind of ping checking or way to WaitFor command with a timeout so you can test if the menu ever appears and if it does do X

You can test this by
Code: Select all
LoadGame();
function main(){
Game.chooseFlowerMenuOption("Collect Branches");
}


then if I go to any tree and right click manually, the menu gets selected. But not for a few fractions of a second. So you have to code with these time differences in mind
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Prime - Amber tweaks and Scripting API

Postby Paradoxs » Tue Dec 20, 2016 11:33 pm

Map Objects Issue
The fix for the map objects issue has been put forth and appears to be working, this fix alters the way Prime runs and manages scripts so a re-write of the entire Prime foundation is being undergone. I expect it to take a decent chunk of time, but the new release should still hit by the end of the day.

Some changes
Game is no longer a variable we use. All functions can be called without it, for example:
Code: Select all
//Old
Game.Login("test", "password");
//New
Login("test", "Password");


LoadGame(); has also been removed, it is no longer needed, Prime will check and make sure your functions have been properly loaded.

Some interface changes:
Some functions no longer give you the same result. Prime now handles a bridge layer that converts java objects into js ones and handles cross communication. This is what prevents MapObjects from giving you the address to a point in memory, and instead rendering usable checkable objects. As such a few things are now restrictions.

All functions pre-defined by prime, are protected. Running a script with functions named the same will result in duplicate declaration errors.

Variables defined by prime are now prefaced: __Prime__
as long as your variable names are not prefaced you cant be certain to not run into any issues.

Events
Prime will still have events in the next release, but I am debating removing them entirely, feedback would be helpful in the making of this decision.
User avatar
Paradoxs
 
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

PreviousNext

Return to The Wizards' Tower

Who is online

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