SRL Archive - OSR Help

GetXPBar Help


King

2012-06-20 21:47:03

Im working on a private butter churner, I have it all working except using the churn. I need to have a static wait time for the butter churning, it takes approx 2.3 minutes to do a full inventory of wheels.

This is what I have for my churn function

Procedure UseChurn;
Begin
repeat
If FindDTMRotated(Churn, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) Then
Begin
CheckXP; <-- finds initial exp
WriteLn('We found the churn');
MMouse(X, Y, 3, 3);
ClickMouse2(False);
WaitOption('hurn',250);
IncEx(Wheels, 28);
wait(1200+random(50))
While IsMoving Do Wait(RandomRange(50,100));
Mouse(322,427,5,5,True);
Wait(250+random(50));
repeat
CheckXP2; <--- checks the amount again
if (XP-XP2<1792) then <-- subtracts them and checks difference, if not
begin <----- specified difference then it waits half a second and checks
wait(500); <--- again until it is the specified difference
end;
until(XP-XP2>=1792);
wait(500+random(250));
exit;
End Else
WriteLn('We could not find the churn');
Inc(Fail);
until(FindDTMRotated(Churn, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/30, aFound) or (Fail=10))
End;

procedure CheckXP;
begin
XP:=GetXPBar(1);
end;

procedure CheckXP2;
begin
XP2:=GetXPBar(1);
end;

^ These are my checking procedures that are called in the script. It does not stop after it reaches the full exp, can anybody see why? Also I know my standards are horrible XD Thanks for any help. Any ohter suggestions as to how to know when it is out of cheese wheels?

Ashaman88

2012-06-20 23:01:24

Why not make a dtm for the cheese wheels and have it wait for no more cheese wheels found in inventory? I'm not sure how the churning works though

riwu

2012-06-20 23:06:05

U are repeatedly calling CheckXp2 by using it in a repeat loop (this means the value of the recorded xp will change each time u go around the loop. U should just call CheckXp2 ONCE before the repeat loop.

Also you are using "else" rather than "if not" in ur actual script right?

bolshak25

2012-06-20 23:12:54

i feel like it should be xp2-xp instead of xp-xp2.
say i had 10xp for xp, then i have 2000 for xp2, with yours, it would be 10 -2000= -1990
which is less than 1792, whereas xp2-xp would get me 2000 -10= 1990 which is greater than 1792 so it would move on.

King

2012-06-21 16:29:49

From: bolshak25
i feel like it should be xp2-xp instead of xp-xp2.
say i had 10xp for xp, then i have 2000 for xp2, with yours, it would be 10 -2000= -1990
which is less than 1792, whereas xp2-xp would get me 2000 -10= 1990 which is greater than 1792 so it would move on.


This, :duh: Thankyou(: Also I tried the DTM and it sometimes would not find it, if I use exp it will be exact(I may suck at making DTMs as well :P

P1ng

2012-06-21 18:39:32

You should try checking these:
http://villavu.com/forum/showthread.php?t=77691
http://villavu.com/forum/showthread.php?t=564

great DTM tutorials out, and for any points (usually only the mainpoint) that you dont place along the black outline make sure you have some tolerance as their colours WILL change.
Also in the DTM editor you are able to test and see where on the screen it is resulting positive for the DTM you made and you'll know if you need to add more points or edit it in some way to make it more accurate.

King

2012-06-21 19:11:41

From: p1ng
You should try checking these:
http://villavu.com/forum/showthread.php?t=77691
http://villavu.com/forum/showthread.php?t=564

great DTM tutorials out, and for any points (usually only the mainpoint) that you dont place along the black outline make sure you have some tolerance as their colours WILL change.
Also in the DTM editor you are able to test and see where on the screen it is resulting positive for the DTM you made and you'll know if you need to add more points or edit it in some way to make it more accurate.


I appreciate it(: Thankyou!