Prime - Amber Tweaks and Scripting API

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

Re: Prime - Amber tweaks and Scripting API

Postby lacucaracha » Tue Dec 20, 2016 2:38 am

LostJustice wrote:
lacucaracha wrote:
LostJustice wrote:Also I noticed another bug with the client that has to do with Game.getMapObjects.

If you do var list = Game.getMapObjects();

Then chop down a tree.

Do var list2 = Game.getMapObjects();

Then list == list2 is true. This should be false because you chopped down a tree which is an object hence the lists should be different but they are the same meaning the getMapObjects(); is not updating the chopped down tree.

What slipper said. Its not a bug in the client, the object id just doesnt change. But thats weird because even tho the elements may be equal, the array itself isnt equal. Maybe its some JS 'feature'


If array is equal to each other, by definition, then every element of one array is equal to every element of another array and the arrays are the same size. So it still should not be returning true.


What you said is true. if the array is equal, then every element is equal. But it doesnt mean that if every element is equal the array is equal.

The array points to a position in the memory that has its elements. There are 2 different pos with the same elements, thats why it should be false (because you're comparing the positions, not the elements).

Still, what u said about the stumps is true.
User avatar
lacucaracha
 
Posts: 171
Joined: Thu Dec 05, 2013 4:50 pm

Re: Prime - Amber tweaks and Scripting API

Postby LostJustice » Tue Dec 20, 2016 3:10 am

lacucaracha wrote:~Snip.


I forgot about that. :roll: I see what you are saying now, thank you for reminding me. However, it isn't accounting for the logs still, also I did a check to see if the object is updated via fullName check. Theoretically the object may have maintained the same id but since it is using a different texture then the fullName path is different as proven via shift + hover over object. The object fullNames are exactly the same in both instances indicating the mapObjects is not being update unless some sort of event or map load event is called.

This can be further proven via the creature found event. Place a hedgehog in a fenced in area just off your screen then place a bot to walk to that area. On the event of finding the hedge hog, have the bot teleport back to it's hearth fire. Then have the character walk towards the hedge hog again. The second time, the bot will not log out. Hence once the object is discovered it cannot be rediscovered which potentially could kill auto foragers and ect. The only way to secure this from happening is to add the creature to a list and consistently check the distance of the player to the object.

So the event system, I am assuming here because I have not looked into the script engine code, is putting the objects that are new into a list which fires off an event but then if the object is rediscovered then it does not fire off the event because it is already contained in said list.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber tweaks and Scripting API

Postby lacucaracha » Tue Dec 20, 2016 3:19 am

LostJustice wrote:
lacucaracha wrote:~Snip.


I forgot about that. :roll: I see what you are saying now, thank you for reminding me. However, it isn't accounting for the logs still, also I did a check to see if the object is updated via fullName check. Theoretically the object may have maintained the same id but since it is using a different texture then the fullName path is different as proven via shift + hover over object. The object fullNames are exactly the same in both instances indicating the mapObjects is not being update unless some sort of event or map load event is called.

This can be further proven via the creature found event. Place a hedgehog in a fenced in area just off your screen then place a bot to walk to that area. On the event of finding the hedge hog, have the bot teleport back to it's hearth fire. Then have the character walk towards the hedge hog again. The second time, the bot will not log out. Hence once the object is discovered it cannot be rediscovered which potentially could kill auto foragers and ect. The only way to secure this from happening is to add the creature to a list and consistently check the distance of the player to the object.

So the event system, I am assuming here because I have not looked into the script engine code, is putting the objects that are new into a list which fires off an event but then if the object is rediscovered then it does not fire off the event because it is already contained in said list.


I think what is causing this is the same things that makes you hear curios/alarms only once. I mean, if you see a bear, go away, and see the bear again, you will only hear the alarm on the first time.
User avatar
lacucaracha
 
Posts: 171
Joined: Thu Dec 05, 2013 4:50 pm

Re: Prime - Amber tweaks and Scripting API

Postby Thedrah » Tue Dec 20, 2016 4:03 am

what if you update game with the loadgame()? could the game variable just not be updating with the actual game?
  ▲
▲ ▲
Thedrah
 
Posts: 936
Joined: Fri Apr 08, 2011 2:20 am
Location: behind you

Re: Prime - Amber tweaks and Scripting API

Postby LostJustice » Tue Dec 20, 2016 6:33 am

lacucaracha wrote:
LostJustice wrote:
lacucaracha wrote:~Snip.


I forgot about that. :roll: I see what you are saying now, thank you for reminding me. However, it isn't accounting for the logs still, also I did a check to see if the object is updated via fullName check. Theoretically the object may have maintained the same id but since it is using a different texture then the fullName path is different as proven via shift + hover over object. The object fullNames are exactly the same in both instances indicating the mapObjects is not being update unless some sort of event or map load event is called.

This can be further proven via the creature found event. Place a hedgehog in a fenced in area just off your screen then place a bot to walk to that area. On the event of finding the hedge hog, have the bot teleport back to it's hearth fire. Then have the character walk towards the hedge hog again. The second time, the bot will not log out. Hence once the object is discovered it cannot be rediscovered which potentially could kill auto foragers and ect. The only way to secure this from happening is to add the creature to a list and consistently check the distance of the player to the object.

So the event system, I am assuming here because I have not looked into the script engine code, is putting the objects that are new into a list which fires off an event but then if the object is rediscovered then it does not fire off the event because it is already contained in said list.


I think what is causing this is the same things that makes you hear curios/alarms only once. I mean, if you see a bear, go away, and see the bear again, you will only hear the alarm on the first time.


That is what I am pointing out, yes.

Thedrah wrote:what if you update game with the loadgame()? could the game variable just not be updating with the actual game?


I don't think you should call that but only once. It could cause major performance issues if called multiple times but I can try and see what the results are.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber tweaks and Scripting API

Postby Paradoxs » Tue Dec 20, 2016 9:04 am

LostJustice wrote:
lacucaracha wrote:
LostJustice wrote:
I forgot about that. :roll: I see what you are saying now, thank you for reminding me. However, it isn't accounting for the logs still, also I did a check to see if the object is updated via fullName check. Theoretically the object may have maintained the same id but since it is using a different texture then the fullName path is different as proven via shift + hover over object. The object fullNames are exactly the same in both instances indicating the mapObjects is not being update unless some sort of event or map load event is called.

This can be further proven via the creature found event. Place a hedgehog in a fenced in area just off your screen then place a bot to walk to that area. On the event of finding the hedge hog, have the bot teleport back to it's hearth fire. Then have the character walk towards the hedge hog again. The second time, the bot will not log out. Hence once the object is discovered it cannot be rediscovered which potentially could kill auto foragers and ect. The only way to secure this from happening is to add the creature to a list and consistently check the distance of the player to the object.

So the event system, I am assuming here because I have not looked into the script engine code, is putting the objects that are new into a list which fires off an event but then if the object is rediscovered then it does not fire off the event because it is already contained in said list.


I think what is causing this is the same things that makes you hear curios/alarms only once. I mean, if you see a bear, go away, and see the bear again, you will only hear the alarm on the first time.


That is what I am pointing out, yes.



Interesting, I will look into the code, I may have overlooked something before I release the next update. I'll keep you posted

Thedrah wrote:what if you update game with the loadgame()? could the game variable just not be updating with the actual game?


LoadGame should actually be called LoadPrime, all it does it set the Game variable. In the newer version I'm experimenting with ways of removing the users need to add LoadGame() to their scripts
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 10:09 am

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. Should I just use a random click after or is this a bug thing?
User avatar
wafflecat
 
Posts: 260
Joined: Thu Dec 15, 2011 7:46 pm

Re: Prime - Amber tweaks and Scripting API

Postby Thedrah » Tue Dec 20, 2016 11:33 am

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. Should I just use a random click after or is this a bug thing?


are you using a delay to account for lag? rightclicking an object to selecting flowermenuoption can have a delay from lag 50ms - 1500ms depending on your connection. it was quite common to have a lagdelay function in scrifen for most basic tasks, even pathfinding has a delay from lag
  ▲
▲ ▲
Thedrah
 
Posts: 936
Joined: Fri Apr 08, 2011 2:20 am
Location: behind you

Re: Prime - Amber tweaks and Scripting API

Postby LostJustice » Tue Dec 20, 2016 12:42 pm

Thedrah wrote:
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. Should I just use a random click after or is this a bug thing?


are you using a delay to account for lag? rightclicking an object to selecting flowermenuoption can have a delay from lag 50ms - 1500ms depending on your connection. it was quite common to have a lagdelay function in scrifen for most basic tasks, even pathfinding has a delay from lag


No lag isn't an issue. I can confirm this bug. I think it from the amount of times the script engine iterates through a script. A script seems to be running through a while loop. Hence you call a method and then call the method again immediately after creating a thread like situation. The first one opens and clicks and the second portion opens but doesn't get a chance to click causing the menu to remain open. Or it may be an issue where it choosing the option but the menu gets stuck for some other reason but that is my best explanation.
Image
User avatar
LostJustice
 
Posts: 677
Joined: Sun Mar 25, 2012 3:57 am

Re: Prime - Amber tweaks and Scripting API

Postby Glorthan » Tue Dec 20, 2016 1:11 pm

Thedrah wrote:
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. Should I just use a random click after or is this a bug thing?


are you using a delay to account for lag? rightclicking an object to selecting flowermenuoption can have a delay from lag 50ms - 1500ms depending on your connection. it was quite common to have a lagdelay function in scrifen for most basic tasks, even pathfinding has a delay from lag

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.
Glorthan
 
Posts: 1099
Joined: Tue Jun 11, 2013 4:33 pm

PreviousNext

Return to The Wizards' Tower

Who is online

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