SRL Archive - Jr. Member General Help and Discussion

Is Player Animating?


Torol

2015-02-04 12:38:02

I got stuck with my woodcutting script ( again :( ). I can't detect if my player is animating or not. The problem with the pixel shift is that the player is not always visible because of the trees. Sometimes a tree grows on the screen, covering the player, or the player just goes behind a tree. I tried rotating the camera to make the player visible: it's not good enough, the player can still be hidden. This may will sound stupid, but since color bots work just like a human player, the best would be something that detects sounds, so the bot would only search for a new tree when there are no sound. But I don't know anything about something like this. Give me ideas please!

Thanks for reading!
Torol

Harrier

2015-02-04 12:40:25

Check if you've gained any logs within the last 30 seconds or so. If you haven't just assume you're not cutting the tree.

Torol

2015-02-04 12:44:58

That's a too slow method for me.

rj

2015-02-04 13:24:21

From: Torol
That's a too slow method for me.


Possible methods:

If this for OSR you could use reflection. When you get the script to click the tree, store the tile in which the tree was located. Keep chopping the tree until the object at that spot is no longer there.

If this is for RS3, you could do the same thing, but it may not be as accurate. Once you click the tree, store you're current SPS coords inside of a variable, and then use MMtoMS (should ask @Olly; @The Mayor; does SRL-6 have this?) and search for the tree.

Smidqe

2015-02-04 13:28:53

From: Robert
Possible methods:

If this for OSR you could use reflection. When you get the script to click the tree, store the tile in which the tree was located. Keep chopping the tree until the object at that spot is no longer there.

If this is for RS3, you could do the same thing, but it may not be as accurate. Once you click the tree, store you're current SPS coords inside of a variable, and then use MMtoMS (should ask @Olly; @The Mayor; does SRL-6 have this?) and search for the tree.


Yep, minimap.pointToMainscreen (IIRC)

Torol

2015-02-04 14:41:23

@Robert Sorry, it's RS3!

KeepBotting

2015-02-04 18:08:23

From: Torol
@Robert Sorry, it's RS3!


You say tracking inventory shift (as @Hawker; said) is too slow - but check and see how iOak does it. I think you'll find the method is reasonably speedy if you set the constants based on your skill level.

Another way to do it is rotate the camera until the color of your player is found inside mainScreen.playerBox, then start tracking pixelshift from there since you know you can see your player.

Torol

2015-02-04 19:24:14

Ok, so I managed to get the coordinates of the currently chopped tree. When I click on the tree, I put the mouse position in a variable, then while walking I refresh this variable, always with the TPoint closest to the previous value.

if (minimap.isPlayerMoving() or minimap.isFlagPresent()) then
repeat
findColorsSpiralTolerance(x,
y,
TPA,
ROOT_COLOR,
mainScreen.getBounds(),
ROOT_TOL,
colorSetting(2, ROOT_HUE, ROOT_SAT));
ATPA := TPA.toATPA(10, 10);
FilterTPAsBetween(ATPA, 0, 15);
ATPA.sortFromMidPoint(TreeCoord);

TreeCoord := middleTPA(ATPA[0]);
until(not minimap.isPlayerMoving() and (not minimap.isFlagPresent()));

It looks like it will work for now. Except if there is a tree growing up exactly while walking. It would be better if I knew where my player is facing. SO now I make from this TPoint a TBox, which includes the tree's unique color if it's cut down. But there is the problem: I have to check if this TBox is not covered by an other tree's leaves. If it is covered, then I obviously rotate the camera, left or right. The problem is: the TBox is rotating too. Now I have to rotate the camera and then move my TBox, to check if it's covered or not. I have no clue how to do this

Torol

2015-02-05 09:05:20

From: KeepBotting

Another way to do it is rotate the camera until the color of your player is found inside mainScreen.playerBox, then start tracking pixelshift from there since you know you can see your player.


If I won't be able to do it in an altenative way then that will be the solution… but then unfortunately I can't publish the script.

cosmasjdz

2015-02-05 09:32:20

Make your players costume front differ from back, like jacket or something so you can determine if its front or back. Also you could wear glory or str amulet since they have quite unique colors to search for them deciding front or back. Personally had once used shield inside and outside colors to determine where i am facing before, but now using other methods in combat scripts.

You could also search chatbox to determine if you ever started chopping tree. If you started you are chopping until tree is dead. So could search for tree stump to determine if tree is dead along with tabbackpack.waitforshift as failsafe.

If you cant find your account front or tree its prolly covered with other tree leaves. So make failsafe as something like setting mainscreen angle high in that case or rotating camera.

Torol

2015-02-06 09:45:04

From: cosmasjdz
Make your players costume front differ from back, like jacket or something so you can determine if its front or back. Also you could wear glory or str amulet since they have quite unique colors to search for them deciding front or back. Personally had once used shield inside and outside colors to determine where i am facing before, but now using other methods in combat scripts.

You could also search chatbox to determine if you ever started chopping tree. If you started you are chopping until tree is dead. So could search for tree stump to determine if tree is dead along with tabbackpack.waitforshift as failsafe.

If you cant find your account front or tree its prolly covered with other tree leaves. So make failsafe as something like setting mainscreen angle high in that case or rotating camera.


How can you read the chatbox? I thought it's not built in SRL?

masterBB

2015-02-06 13:08:14

From: Torol
How can you read the chatbox? I thought it's not built in SRL?


https://github.com/SRL/SRL-6/blob/master/lib/interfaces/chatbox.simba#L186