Log in

View Full Version : Adding a kill count?



laakerules
12-30-2011, 08:16 PM
How would i add a kill counter to my script and then make it say how many kills happened inside the progres report!

Kyle Undefined
12-30-2011, 08:19 PM
You would declare a global variable, then as you kill the monster/npc, you would do: "Inc(yourVar);" and to print it out "WriteLn('Killed: ' + IntoToStr(yourVar));"

laakerules
12-30-2011, 08:23 PM
I tried that, but it isnt working on the counting part. It stays at 0. I have to make a function for the counter correct? and if so what would the simba code look like?

Kyle Undefined
12-30-2011, 08:31 PM
Then you're not setting it up correctly. Show your code please?

laakerules
12-30-2011, 08:41 PM
procedure KCount;
begin
repeat
Inc(Kills);
until(Kills = 9999);
end;


That is my kill counter

And then my progress report.

Procedure ProgressReport;
begin
ClearDebug;
Writeln('***************************************** ***');
Writeln('* Name of script *');
Writeln('***************************************** ***');
Writeln('* Killed ' + AttackingOption + ' NPCs');
Writeln('You have killed ' + IntToStr(Kills) + ' '+AttackingOption+'');
Writeln('* Ran for ' + TimeRunning + '');
Writeln('***************************************** ***');
end;

and i have tried both haveing the variable at the top with all the other global variables. and i tried at the bottom with the script runner.

Kyle Undefined
12-30-2011, 08:47 PM
Rare you setting Kills to 0 at any point? That's the only thing I can think of, that code should work.

laakerules
12-30-2011, 08:49 PM
Nope, im just getting the error of the variable doesnt exist now. How should i declare the variable.

Kills= Integer;

or how?

shnk
12-30-2011, 08:57 PM
Nope, im just getting the error of the variable doesnt exist now. How should i declare the variable.

Kills= Integer;

or how?

I'm new to this but wouldn't you declare your variable like this


var Kills: integer;

laakerules
12-30-2011, 08:58 PM
Yeah, thats how you declare it inside a procedure im pretty sure. but how would i declare it in the global declaring area?

Kyle Undefined
12-30-2011, 09:14 PM
It's the same way, just at the top, outside of a procedure.

laakerules
12-30-2011, 09:15 PM
oh ok ill try that

laakerules
12-30-2011, 09:17 PM
Sweet lol, i never tried declaring it that way thanks

Kyle Undefined
12-30-2011, 09:17 PM
I assumed you were :p

laakerules
12-30-2011, 09:35 PM
Nw heres a code giving me major troubles. How would i make it right click then go to ake bone. Because rite now its clicking the whold pile until it gets the bone.



procedure PickupBones;
var
sX,sY: Integer;
begin
if PickupBone = 'Regular' then
FindObjSimple_F([13422806, 14014175], ['ake','Bones'], MSCX, MSCY);
writeln('Picking up Bones!');
While IsMoving do
wait(1);
FindNormalRandoms;
wait(randomrange(1400,2000));
end;

shnk
12-30-2011, 09:40 PM
Nw heres a code giving me major troubles. How would i make it right click then go to ake bone. Because rite now its clicking the whold pile until it gets the bone.



procedure PickupBones;
var
sX,sY: Integer;
begin
if PickupBone = 'Regular' then
FindObjSimple_F([13422806, 14014175], ['ake','Bones'], MSCX, MSCY);
writeln('Picking up Bones!');
While IsMoving do
wait(1);
FindNormalRandoms;
wait(randomrange(1400,2000));
end;


Err i think you could use Mouse (x, y, 5, 5, false) and then ChooseOption ('ake Bones')

laakerules
12-30-2011, 09:42 PM
Hmm maybe, Tried it. Didnt work did same thing. Maybe you could try implementing that into the script if you have some secret special way of it

Kyle Undefined
12-30-2011, 09:47 PM
procedure PickupBones;
var
sX,sY: Integer;
begin
if PickupBone = 'Regular' then
begin
FindObjSimple_F([13422806, 14014175], ['ake','Bones'], MSCX, MSCY);
writeln('Picking up Bones!');
While IsMoving do
wait(1);
FindNormalRandoms;
wait(randomrange(1400,2000));
end;
end;


Try that.

laakerules
12-30-2011, 09:48 PM
Hey Kyle Undifined, Its still not working.
Dont i have to implement the factor telling it to add 1 to the kill count suck as

if (Killing) then
KCount

and if so then were?

laakerules
12-30-2011, 09:52 PM
Nope that one didnt work it still just clicks it one time no matter whats on top!

legoace
12-31-2011, 02:14 AM
That's probably because that's what FindObjectSimple_F is supposed to do. (just guessing because I've never seen that function)

Try this

procedure PickupBones;
var
sX,sY: Integer;
begin
if PickupBone = 'Regular' then
begin
FindObjCustom(sX, sY, ['ake','Bones'], [13422806, 14014175], 10);
writeln('Picking up Bones!');
While IsMoving do
wait(1);
FindNormalRandoms;
wait(randomrange(1400,2000));
end;
end;


The only extra argument is the last one, "10," that's the color tolerance - as it gets larger, more colors will be seen as "close enough" to the ones in brackets before.

If this doesn't work check back and I'll post a nice TPA object function to use but this one should be okay.

laakerules
12-31-2011, 06:01 AM
Nope, i need it to right click the go to ake bones. that one just hovers over it and if it doesnt say ake Bones then it moves on!

Brandon
12-31-2011, 06:08 AM
Nope, i need it to right click the go to ake bones. that one just hovers over it and if it doesnt say ake Bones then it moves on!

That's because your using a function from flight's nature script without know how it works -__-
I believe that function was the one he used for the bank chest and it one clicks because no one can stand on it.. thus the up-text always shows when the mouse hovers..

His Function:

Function FindObjSimple_F(Colors: TIntegerArray; TheUpText: TStringArray; midx, midy: integer): Boolean;
Var
T,i,X,Y: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
MarkTime(T);
Repeat
SetArrayLength(ATPA, Length(Colors));
for i := 0 to High(Colors) do
FindColorsSpiralTolerance(midx, midy, ATPA[i], Colors[i], MSX1, MSY1, MSX2, MSY2, 15);
TPA := MergeATPA(ATPA);
ATPA := TPAtoATPAEx(TPA, 15, 15);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if (Length(ATPA) = 0) then
Exit;

MiddleTPAEx(ATPA[0], x, y);

if (TimeFromMark(T) > 5000) then
Exit;

MMouse(x, y, 10, 10);
Wait(randomrange(75,125));
If(IsUpTextMultiCustom(TheUpText)) then
begin
ClickMouse2(True);
if DidRedClick then
begin
Result := True;
Break;
end;
end;
Until(Result)
end;

laakerules
12-31-2011, 06:11 AM
I already have a find simple object in my script for attacking!

Brandon
12-31-2011, 06:15 AM
I already have a find simple object in my script for attacking!

Wut? I never mentioned attacking :S I said your using a function that you do not know how it works..

In the function you can see it says if uptextmulticustom then clickmouse2(true).. no where does it say clickmouse2(false).. ChooseOptionMulti(Uptext);.....


You might want to learn how his function works before going off and using it.. Most people who replied to your thread did not know where you got the function and why it did not work for you -_- Neither did you.

Anyway.. make the changes I said and it will right click all the time if not ismultiuptextcustom.

laakerules
12-31-2011, 06:28 AM
Well i never got from an herblore script like you said! :P

Okay, i tried to figure that clickmouse2true thing out. But it still didnt work. Sorry im new to simba. I am good at java so its only a little different.