SRL Archive - General Botting Help

are the > and < signs mixed up?


theholyone

2015-02-24 03:01:16

After struggling for 3hrs now, I have finally got my little snipit of code working, but i've found one little problem

the less than < and greater than > signs have been mixed up

if i do


if apples > 50 then
writeln('apples are greater than 50');
else if apples < 50 then
writeln('apples are less than 50');

the results will be the opposite,
where apples > 50 will print out less than
and apples < 50 will print out greater than


unless i'm just a complete fool and i'm somehow reading the signs wrong..


and that is not the snippet i spent 3hrs on :P luckily lol

riwu

2015-02-24 03:17:01

Can u show the actual code?

KeepBotting

2015-02-24 07:31:00

> is greater than
< is less than

To what value have you assigned apples? Therin may lie the issue

Run this:

program new;

var
apples:integer;

begin
if (1 > 0) then
writeLn('This will print because one is greater than zero');

if (1 < 0) then
writeLn('This will NOT print because one is NOT less than zero');

apples := 100;

if (apples > 1) then
writeLn('This will print because apples is 500, and this is greater than one');

if (apples < 1000) then
writeLn('This will print because apples is 500, and this is less than 1000');
end.

Maybe that will alleviate some confusion :p

cosmasjdz

2015-02-24 08:52:08


if apples > 50 then
writeln('apples are greater than 50'); <- boom statement ended


Basicly before else semicolon isnt being written or it messes up. It is not needed. Pascal syntax requires before Else not to put semicolon
Its like this:



If statement then
action
else
other action;

{if using more than one action then}

if statement then
begin
action1;
action2;
end <-no ;
else
begin
moreaction1;
moreaction2;
end;

samerdl

2015-02-24 11:18:28

Post the code bro

theholyone

2015-02-24 12:12:01

sorry, couldn't get online until now

here's the code, most of it has been taken from RlagkRud's lazy runespan and edited




function check(): boolean;
begin
if ess < 50 then
begin
writeln('Doing gather procedure');
Gather;
end else if ess > 500 then
begin
writeln('Have more than 500, doing main procedure');
IdentifyTarget;
end;
end;


and here is the procedure for the gather


function Gather: boolean;
begin
Timeout.reset;
Timeout.start;
identity := 0;

Repeat

If (Not IsLoggedIn OR (Timeout.gettime > 10000)) Then
Exit;

//Air essling [CHECKED]
if FindColorTolerance(Obx,Oby, 14463859, 0 , 0, 571, 383, 3) then
begin
Writeln('////Identified Air ESSLING');
Mouse(Obx,Oby,Mouse_move);
wait(randomrange(300,500));
Fastclick(Mouse_right);
if (chooseOption.select(['Air', 'ling'], 500)) then
break;
end ;


wait(gaussrangeint(1000,1200));
////Until ess < 500;< - same deal with the < and > signs here
Result := True;

end;

taken from RlagkRud's lazy runespan


i've been working this part over and over again, and sometimes the > will act as greater, and sometimes it will act as less than :S

Chris

2015-02-24 12:32:33

How and where do you assign ess? (assuming it's a variable)

the bank

2015-02-24 12:40:27

From: Chris
(assuming it's a variable)


As opposed to…?

@OP I can't recreate your problem.

Apples = 35:
program new;
var
apples : Integer;
begin
apples := 35;
if (apples > 50) then
begin
writeln('apples are greater than 50');
end else if (apples < 50) then
writeln('apples are less than 50');
end.

Output:
Apples are less than 50


Apples = 55:
program new;
var
apples : Integer;
begin
apples := 55;
if (apples > 50) then
begin
writeln('apples are greater than 50');
end else if (apples < 50) then
writeln('apples are less than 50');
end.

Output:
Apples are greater than 50

theholyone

2015-02-24 13:05:40

From: the bank
As opposed to…?

@OP I can't recreate your problem.

Apples = 35:
program new;
var
apples : Integer;
begin
apples := 35;
if (apples > 50) then
begin
writeln('apples are greater than 50');
end else if (apples < 50) then
writeln('apples are less than 50');
end.

Output:


Apples = 55:
program new;
var
apples : Integer;
begin
apples := 55;
if (apples > 50) then
begin
writeln('apples are greater than 50');
end else if (apples < 50) then
writeln('apples are less than 50');
end.

Output:



I think the problem is i'm not using a set amount to determine less than or greater than,

i'm using


function ess: integer;

begin
getItemAmount(tabBackpack.getSlotBox(1));
end;

Brandon

2015-02-24 13:11:00

From: the bank
…


Using your example, one way to reproduce the problem is:


program new;
var
apples : Integer;
begin
apples = 100; //notice this is the WRONG assignment operator.
writeln(apples);
if (apples > 50) then
begin
writeln('apples are greater than 50');
end else if (apples < 50) then
writeln('apples are less than 50');
end.


No matter what, this will print that apples are < 50 even though I've assigned it a value of 100. When you print "apples", it prints 0 instead of 100 because the wrong assignment operator has been used (and it will never give you a compiler error). I've purposely used the constant assignment operator rather than the variable assignment operator in the above example.


This can be ONE of the many causes of OP's script behaviour. Especially because Lape uses the same operators for more than one operation:


const
a = 10; //const assignment operator.

if (a = b) //comparison operator.

var
a: some_structure;

a = [blah, meh, foo]; //lazy initialisation assignment operator (I think).

var
a: Integer = 10; //lazy initialisation operator (I think).

var
a: Integer;

a := 35; //variable assignment operator.


var
a: Integer := 10; //initialisation operator.

I might be mixing up lazy initialisation with immediate initialisation but you get the idea (maybe I swapped the operators, I'm not too sure).


If OP somehow used the wrong operator, it would definitely explain the behaviour he/she is experiencing (however, below is the real source of the problem [not the above operators]).


Finally, OP:

From: theholyone
I think the problem is i'm not using a set amount to determine less than or greater than,

i'm using


function ess: integer;
begin
getItemAmount(tabBackpack.getSlotBox(1));
end;




is incorrect.. you never assigned to "result".

The correct function code is:


function ess: integer;
begin
result := getItemAmount(tabBackpack.getSlotBox(1)); //result := blah..
end;

//OR:


function ess: integer;
begin
exit(getItemAmount(tabBackpack.getSlotBox(1))); //exit(blah).. same as "return blah" in other languages.
end;

the bank

2015-02-24 13:19:16

From: Brandon
…


Never understood why they don't atleast make this throw a warning at compilation. I'd hazard 90% of beginning scripting problems is due to this operator.

theholyone

2015-02-24 14:36:53

From: Brandon




wow…
this entire time I have been stumped because of what I thought was the most basic and easy code…
turns out that the result := has fixed the problem of reading the result of counts

thank you so much for finding out what the problem was