Log in

View Full Version : Loop Error and FindTalismanInInventory Error



joey0101
01-14-2007, 02:11 PM
im trying to write a air crafter and when testing certain procedures i came across certain bugs, the code samples below both contain errors and i don't know why can anyone help me.


program aircrafter;
var airrmade, i:integer;
const
tripstomake = 100000;//Amount of essence you want to convert
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\RuneCrafting.scar}
procedure DeclarePlayers;
begin
howmanyplayers:= 2;
NumberOfPlayers(howmanyplayers);
currentplayer:= 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := true;

Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := ''
Players[1].Active := true;
end;
function findtally:boolean;
begin
LoadSRlTalismanBitmaps;
if(not FindTalismanInInventory('air', 12)) then
begin
Writeln('you do not have an air Talisman... logging out');
result:= false;
logout;
NextPlayer(false);
end;
end;
procedure gettoalter;
begin
perfectnorth;
end;
begin
setupsrl;
LoadSRlTalismanBitmaps;
DeclarePlayers;
LoginPlayer;
repeat
if (findtally) then
begin
break;
end;
until(findtally = true);
writeln('hello');
end.

Error = Loop is endless even when i have a talisman in my inventory.


program aircrafter;
var airrmade, i:integer;
const
tripstomake = 100000;//Amount of essence you want to convert
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\RuneCrafting.scar}
procedure DeclarePlayers;
begin
howmanyplayers:= 2;
NumberOfPlayers(howmanyplayers);
currentplayer:= 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := true;

Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := ''
Players[1].Active := true;
end;
function findtally:boolean;
begin
LoadSRlTalismanBitmaps;
if(not FindTalismanInInventory('air', 12)) then
begin
Writeln('you do not have an air Talisman... logging out');
result:= false;
logout;
NextPlayer(false);
end;
end;
procedure gettoalter;
begin
perfectnorth;
end;
begin
setupsrl;
LoadSRlTalismanBitmaps;
DeclarePlayers;
LoginPlayer;
repeat
if (findtally) then
begin
break;
end;
until(FindTalismanInInventory('air', 12));
writeln('hello');
end.
Error = [Runtime Error] : Exception: Access violation at address 00650C79 in module 'scar.exe'. Read of address 00000030 in line 324 in script C:\Program Files\SCAR 2.03\includes\SRL\SRL\Skill\RuneCrafting.scar

does anyone know whats wrong

whales
01-15-2007, 12:35 AM
Your includes did not have a backlash between files, \

program aircrafter;
var airrmade, i:integer;
const
tripstomake = 100000;//Amount of essence you want to convert
{.include SRL\SRL.scar}
{.include SRL\SRL\Skill\RuneCrafting.scar}
procedure DeclarePlayers;
begin
howmanyplayers:= 2;
NumberOfPlayers(howmanyplayers);
currentplayer:= 0;

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := true;

Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := ''
Players[1].Active := true;
end;
function findtally:boolean;
begin
LoadSRlTalismanBitmaps;
if(not FindTalismanInInventory('air', 12)) then
begin
Writeln('you do not have an air Talisman... logging out');
result:= false;
logout;
NextPlayer(false);
end;
end;
procedure gettoalter;
begin
perfectnorth;
end;
begin
setupsrl;
LoadSRlTalismanBitmaps;
DeclarePlayers;
LoginPlayer;
repeat
if (findtally) then
begin
break;
end;
until(findtally = true);
writeln('hello');
end.

xxlegitxx
01-16-2007, 11:03 PM
The default result is true, not false. In findtally, you never included a result:=true. And that code is really convoluted. There has to be a better way to express that. And btw, put a FTWait somewhere in if(FindTally).

Bebe
01-16-2007, 11:14 PM
The default result is true, not false. In findtally, you never included a result:=true. And that code is really convoluted. There has to be a better way to express that. And btw, put a FTWait somewhere in if(FindTally).

Are you calling my code bad? :tongue: :spot:

xxlegitxx
01-16-2007, 11:24 PM
Are you calling my code bad? :tongue: :spot:

I don't see what you are trying to insinuate.

EDIT: Oh. No, I was referring to his code, not FindTalismanInInventory.

Bebe
01-16-2007, 11:32 PM
I was just joking :)

@joey0101 Please space your procedures/functions it makes it more readable.

xxlegitxx
01-16-2007, 11:52 PM
I was just joking :)

@joey0101 Please space your procedures/functions it makes it more readable.

Yea, I didn't catch that. I tend to skip over smilies.

joey0101
01-17-2007, 09:28 PM
I was just joking :)

@joey0101 Please space your procedures/functions it makes it more readable.

OK, oh and whales I used '/' instead of '\', but it dosen't show up.

joey0101
01-17-2007, 09:39 PM
i've fixed the problem now, i also made a slight change to FindTalismanInInventory, it stoped the second error

whales
01-18-2007, 03:30 AM
I wouldn't mind seeing the fixed version... Whatd you change?

Bebe
01-18-2007, 03:36 AM
I wouldn't mind seeing the fixed version... Whatd you change?
Yes please do....