View Full Version : SRL Function Help
Mr. Doctor
01-13-2010, 11:12 PM
I need to take a survey to get this waiting procedure right.
I need people to post the average time they wait until they get a log from a tree. Preferably every tree.
Ex.
Chop tree. //Mark your time from here
Wait //seconds
Get log// End your time here and post
Template=
Tree:
Time:
Axe:
Level:
Rewards available.
Rep
Timer
01-13-2010, 11:18 PM
i := InvCount;
Marktime(ii);
while (InvCount = i) do
begin
Wait(50);
if (TimeFromMark(ii) > 45000) then
begin
WriteLn('Oh shit somethings wrong..');
Break;
end;
//Checking if cutting stopped.
end;
That's what I would do. :o
or something more like..
function GimmeaLog: Boolean;
var
i, ii: Integer;
begin
i := InvCount;
Marktime(ii);
while (InvCount = i) do
begin
Wait(50);
if (TimeFromMark(ii) > 45000) then
begin
WriteLn('Oh shit somethings wrong..');
Exit;
end;
//if (not CuttingTree) then
//begin
// WriteLn('Not cutting?! D:');
// Exit;
//end;
end;
Result := True;
end;
Heavenguard
01-13-2010, 11:19 PM
:O sorry for me like suggesting, ill help out with this, but did you try to do an InvCheck? Something like this to detect if something has appeared in the Inventory.
I got Ninjad.
Mr. Doctor
01-14-2010, 01:01 AM
It's a brand new function I'm making for trees that give you multiple logs. It somewhat has something to do with InvCount.
mrpickle
01-14-2010, 03:37 AM
Tree: Willow
Time: 4 sec ?
Axe: Rune
Level: 65
The answers you get for htis survey will not be accurate because noby really times this kinda stuff... We just let the computer do its thing >.<.
If you really need information on Time get log/ axe/tree. Why not make counters, and marktime in a WC script and leave it on for a few hours, and find the average of the numbers? Wayy more accurate than us telling you the time.
The axe, is 95% + rune.
Only thing I find worthwhile is checking botter;s lvs atm :).
A better way (for trees like willows and oaks) would be:
When you chop the tree you set a mark and do a repeat check to check the inventory and when a new log appears increment the amount of logs the tree gave/total chopped and then also do a ismoving check and when you aren't moving then you aren't chopping. You could also check for differences in a TBox around your player. I haven't scripted in a long time but I might get back into it..
YoHoJo
01-14-2010, 06:41 AM
I need people to post the average time they wait until they get a log from a tree. Preferably every tree.
(You know that inst the same as time to cut a tree (unless you are doing regular trees) because each tree gets multiple logs).
So, anyways, here is a messy example!
Program ISuckAtScrupting;
CutTimesArray:TIntegerArray;
TotalCutTime:Integer;
Procedure AddTime(WatTime:Integer);
Begin
SetArrayLength(CutTimesArray,GetArrayLength(CutTim esArray)+1);// Makes array one number longer
CutTimesArray[GetArrayLength(Slot)-1]:=WatTime;// Adds integer 'WatTime' to end of array
End;
Procedure Cutsor;
var OldInvCount,TreeCuts:Integer;
Begin
ClickTree; //Clicks The Tree
Begin
OldInvCount:=InvCount; //Gets Invnetory Count
MarkTime(TreeCuts); //Makrs Time
Antiban; AniRandoms; //Antiban/AntiRandoms
If InvCount>OldInvCount Then //If inventory count has risen since tree clicked
Begin
AddTime(TimeFromMark(TreesCut)); //Add the time from marker to the array of times
ClickAnotherTree; //If you want to cut another tree right after you get logs?
End;
End;
End;
Function AverageTimes:Integer;
Begin
TotalCutTime:=0; //Resets total time
For I:=0 To GetArrayLength(CutTimesArray) Do //Goes from 0 to Legnth of CutTimesArray
Begin
TotalCutTime:=TotalCutTime + CutTimesArray[I]; //Adds up all of the cut times
Result:= (TotalCutTime/ (GerArrayLength(CutTimesArray)); //Averanges the cut times
End;
End;
DOH! Just found This:
Function AverageCutTime:Integer;
Begin
Result:= AverageTIA(CutTimesArray);//Averages a TIntegerArray -.-
End;
Ask any questions, I hope I did it correctly! :p
Mr. Doctor
01-14-2010, 08:33 PM
I would like to know Tboxes. Any place where i can learn them? Link PLOX? Much easier then my technique because my bro uses Tboxes to see if the tree is cut or not.
Heavenguard
01-14-2010, 09:02 PM
Why not make the character click the tree, while its animating the chop wait/w/e, and then when its done then try to chop again?
TBoxes are types that contain 4 integers.
x1, y1 : the top left corner
x2, y2 : the bottom right corner
Mr. Doctor
01-14-2010, 09:44 PM
TBoxes are types that contain 4 integers.
x1, y1 : the top left corner
x2, y2 : the bottom right corner
Ok, where do i use these, what function, and what parameters?
YoHoJo
01-14-2010, 10:24 PM
Lol, totally changed the topic Junkj....
Did you look at my code? :p
Well what exactly do you wan to do with tboxes? Check to see if a tree is cut?
Procedure MakeABox;
var MahBox:TBox;
Begin
MahBox:=IntToBox(563, 213, 594, 244);
End;
You would just need to somehow find the x1,y1,x2,y2 of the specific tree you are cutting, and put those cords into IntToBox.
If you are using TPAs this will make a box based on the tpa
function GetTPABounds(TPA: TPointArray): TBox;
Returns a TBox with the boundries of TPA.
And this tutorial will help with more TPA stuffs, its really good!
http://www.villavu.com/forum/showthread.php?t=49067
That's just some random info about stuff, hope it helped some.
Why not just make another topic related to your Tbox questions? :p
Lol, totally changed the topic Junkj....
Did you look at my code? :p
Well what exactly do you wan to do with tboxes? Check to see if a tree is cut?
Procedure MakeABox;
var MahBox:TBox;
Begin
MahBox:=IntToBox(563, 213, 594, 244);
End;
You would just need to somehow find the x1,y1,x2,y2 of the specific tree you are cutting, and put those cords into IntToBox.
If you are using TPAs this will make a box based on the tpa
function GetTPABounds(TPA: TPointArray): TBox;
Returns a TBox with the boundries of TPA.
And this tutorial will help with more TPA stuffs, its really good!
http://www.villavu.com/forum/showthread.php?t=49067
That's just some random info about stuff, hope it helped some.
Why not just make another topic related to your Tbox questions? :p
Procedure MakeABox;
var MahBox:TBox;
Begin
MahBox:=IntToBox(563, 213, 594, 244);
End;
Useless..? You assign the box to a local variable so it is discarded since the procedure ends right after assigning it.
YoHoJo
01-14-2010, 11:15 PM
-.- It was just an example, he can make the variable global if he wants.
Mr. Doctor
01-14-2010, 11:26 PM
Ok.. So what parameters would i set so it would be in the middle of the screen? And what function/code would i use to detect if the tree is down? PixelShift?
YoHoJo
01-15-2010, 12:55 AM
What do you mean it?
If you want to guesstimate where a tree is you could do like (MSCX-40,MSCY-40,MSCX+40,MSCY+40), but trees aren't really on the middle of the screen, your character is on the middle, the tree is up/down/left/right from you. Why not looking at coh3ns? two woddcutting scripts, they are really good and I believe he has functions like that. Also, make another topic specifically for this question please? :D
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.