SRL Archive - Help

Adding a kill count?


laakerules

2011-12-30 15:16:00

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

2011-12-30 15:19:25

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

2011-12-30 15:23:28

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

2011-12-30 15:31:54

Then you're not setting it up correctly. Show your code please?

laakerules

2011-12-30 15:41:34


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

2011-12-30 15:47:07

Rare you setting Kills to 0 at any point? That's the only thing I can think of, that code should work.

laakerules

2011-12-30 15:49:03

Nope, im just getting the error of the variable doesnt exist now. How should i declare the variable.

Kills= Integer;

or how?

shnk

2011-12-30 15:57:24

From: laakerules
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

[B]var[/B] Kills: integer; 

laakerules

2011-12-30 15:58:28

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

2011-12-30 16:14:58

It's the same way, just at the top, outside of a procedure.

laakerules

2011-12-30 16:15:46

oh ok ill try that

laakerules

2011-12-30 16:17:16

Sweet lol, i never tried declaring it that way thanks

Kyle Undefined

2011-12-30 16:17:53

I assumed you were :p

laakerules

2011-12-30 16:35:36

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

2011-12-30 16:40:26

From: laakerules
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

2011-12-30 16:42:55

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

2011-12-30 16:47:07

From: laakerules


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

2011-12-30 16:48:53

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

2011-12-30 16:52:59

Nope that one didnt work it still just clicks it one time no matter whats on top!

legoace

2011-12-30 21:14:58

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

2011-12-31 01:01:04

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

2011-12-31 01:08:50

From: laakerules
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

2011-12-31 01:11:55

I already have a find simple object in my script for attacking!

Brandon

2011-12-31 01:15:32

From: laakerules
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

2011-12-31 01:28:57

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.