SRL Archive - Bugs

Bad syntax or a bug?


bugger0001

2010-06-14 10:13:28

Anyways, what I'm doing is:
function EatSome: boolean;
var
EatTime, x, y, a: Integer;
begin
Result := False;
if not LoggedIn then Exit;
if Players[CurrentPlayer].Integers[M_FOODATE]>=27 then Exit;
MarkTime(EatTime);
DBugMe('Trying to eat', True);
repeat
for Players[CurrentPlayer].Integers[M_FOODATE] := Players[CurrentPlayer].Integers[M_FOODATE] to 27 do
if ExistsItem(Players[CurrentPlayer].Integers[M_FOODATE]+1) then
begin
MMouseItem(Players[CurrentPlayer].Integers[M_FOODATE]+1);
if WaitUpText('Eat', 500) then
begin
Wait(100+Random(150));
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
DBugMe('Eating from slot no' + IntToStr(Players[CurrentPlayer].Integers[M_FOODATE]+1), True);
Wait(500+Random(500));
Break;
end;
end;
Result := HPGood;
until(Result or (TimeFromMark(EatTime)>=30000));
end;

The M_FOODATE is a global constant
The problem is that this line:
for Players[CurrentPlayer].Integers[M_FOODATE] := Players[CurrentPlayer].Integers[M_FOODATE] to 27 do
Causes my functions list to stop showing functions and procedures that come after this function. Yet the script itself is working fine. If I replace the line with this:
for a := Players[CurrentPlayer].Integers[M_FOODATE] to 27 do
and do a
Players[CurrentPlayer].Integers[M_FOODATE]:=a;
after the for loop then the functions list works fine. I'm not sure if should change my phrasing or is this a bug in Simba? Worked just fine in SCAR…

Nava2

2010-06-14 12:36:45

Logically.. I don't think that makes sense? :s

Why would you want to count it up like that.. you are setting a variable to itself..

Wizzup?

2010-06-14 13:28:48

From: Nava2
Logically.. I don't think that makes sense? :s

Why would you want to count it up like that.. you are setting a variable to itself..


That doesn't look like the issue of Simba not parsing the code to me.

bugger0001

2010-06-14 17:26:02

From: Nava2
Logically.. I don't think that makes sense? :s

Why would you want to count it up like that.. you are setting a variable to itself..


Well, it's because the value from where I want it to count up from will be different every time I get into this for loop. The value needed for each loop is stored in the variable. Syntax I must use is
for a := b to c do
Therefore I can't do a simple
for a to b do
This way I need one less variable plus I don't have to rewrite the value of this variable after the for loop, it will be done by the for loop itself.

EDIT: Just out of curiosity I tried a few more things. At first I used a global variable in the for loop and if I did this:
for globalvar := globalvar to 10 do
and this one parsed.
Then I tried using SRLs vars:
for Players[i].Integers[0] := 0 to 27 do
and it didn't parse the code.
Therefore I think the problem resides in using vars from Players array as all the variables declared in my script are working good…

Nava2

2010-06-14 23:09:12

I hope there isn't an issue with passing an integer held in a record into a for loop…

nielsie95

2010-06-15 07:10:17

If it compiles it is a parser issue ;)
It looks like Delphi only supports simple vars for for-loops, so no arrays and no records and definitely no combination of the two. I guess I could adjust the parser, though..