Log in

View Full Version : Duplicate Identifiers (Not Common Question)



looneytoon
01-11-2007, 02:54 AM
I was wondering why you cant put functions or procesdures in your script if they are already in srl.scar, trade.scar, etc. You always get a duplicate identifier error. Is there a way to put functions and procedures in the script? Look at this script..when i try to run it i get a duplicate identifier error, am i doing something wrong?

{
__
/\ \
\ \ \ ___ ___ ___ __ __ __
\ \ \ __ / __`\ / __`\ /' _ `\ /'__`\/\ \/\ \
\ \ \L\ \/\ \L\ \/\ \L\ \/\ \/\ \ /\ __/\ \ \_\ \
\ \____/\ \____/\ \____/\ \_\ \_\\ \____\\/`____ \
\/___/ \/___/ \/___/ \/_/\/_/ \/____/ `/___/> \
/\___/
\/__/
____ __
/\ _`\ __ /\ \__
\ \,\L\_\ ___ _ __ /\_\ _____ \ \ ,_\ ____
\/_\__ \ /'___\/\`'__\\/\ \ /\ '__`\\ \ \/ /',__\
/\ \L\ \ /\ \__/\ \ \/ \ \ \\ \ \L\ \\ \ \_ /\__, `\
\ `\____\\ \____\\ \_\ \ \_\\ \ ,__/ \ \__\\/\____/
\/_____/ \/____/ \/_/ \/_/ \ \ \/ \/__/ \/___/
\ \_\
\/_/

_ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( L )( o )( o )( n )( e )( y ) ( M )( e )( r )( c )( h )( a )( n )( t )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/

__________________________________________________ __________________
|Directions |
|Set Public Chat to 'Hide' or 'Friends' and Trade/Compete to 'On' |
|Enter your message in line 40. |
|_________________________________________________ ___________________|}


program LooneyMerchant;

{.Include SRL/SRL.Scar}
{.include srl\srl\extended\xtext.scar}
{.include srl\srl\misc\trade.scar}

Const
Message1 = 'Text Goes Here'; //Enter the message you want to say




procedure autotype;
begin
TypeSend(Message1);
wait(2000);
end;


var
xx,yy,accepttradetab:integer;
xa,ya,tradeop1:integer;


function GetTraderName: string;//This is where the duplicate identifier error is
var
colonx, colony: Integer;
begin
if (TradeScreen) then
begin
if (IsTextInAreaEx(2, 31, 477, 50, colonx, colony, ':', 0, upchars, False,
True, 0, 0, 65535)) then
begin
Result := Trim(GetTextAtEx(colonx + 8, colony, 0, upchars, False, True, 0,
2, 65535, 12, False, tr_AlphaNumericChars))
end
else
WriteLn('Couldnt get trader name');
end;
end;

procedure DeclareBMPS;
begin
accepttradetab := BitmapFromString(19, 13, 'z78DA33301805A380D' +
'6C01989A48F5DF845686717ADED1D281BF193C4E8A29D1F9D E91E' +
'AA83D14600263E17DE');
tradeop1 := BitmapFromString(2, 1, '800080BBAE92');

end;









Procedure FindBMPS;
begin

if(FindBitmap(accepttrade,xx,yy))then
autotype;


if(FindBitmap(tradeop1,xa,ya))then
GetTraderName;



end;

begin
repeat
wait(1300)
autotype;
DeclareBMPS;
FindBMPS;
until(false)
end.

tarajunky
01-11-2007, 03:34 AM
When you include a file, it is like you have already put all those functions into your script. So, you can just call GetTraderName without putting that function in your script.

OR, you can choose not to include the trade.scar file and instead just pick and choose which functions you want to use and copy them directly in as you have done.

looneytoon
01-11-2007, 03:34 PM
thank you so much! you dont know how happy your post has made me!!

looneytoon
01-11-2007, 05:10 PM
Im sorry, could you give me an example of how to use this? I tried using
procedure LocateTrades;
begin
GetTraderName:string;
var
colonx, colony: Integer;
begin
if (TradeScreen) then
begin
if (IsTextInAreaEx(2, 31, 477, 50, colonx, colony, ':', 0, upchars, False,
True, 0, 0, 65535)) then
begin
Result := Trim(GetTextAtEx(colonx + 8, colony, 0, upchars, False, True, 0,
2, 65535, 12, False, tr_AlphaNumericChars))
end
else
WriteLn('Couldnt get trader name');
end;
end;

But it keeps saying identifer expected, what should i do. Thanks

(BUMP)

tarajunky
01-11-2007, 05:33 PM
I've never used this procedure before, but try this.


{
__
/\ \
\ \ \ ___ ___ ___ __ __ __
\ \ \ __ / __`\ / __`\ /' _ `\ /'__`\/\ \/\ \
\ \ \L\ \/\ \L\ \/\ \L\ \/\ \/\ \ /\ __/\ \ \_\ \
\ \____/\ \____/\ \____/\ \_\ \_\\ \____\\/`____ \
\/___/ \/___/ \/___/ \/_/\/_/ \/____/ `/___/> \
/\___/
\/__/
____ __
/\ _`\ __ /\ \__
\ \,\L\_\ ___ _ __ /\_\ _____ \ \ ,_\ ____
\/_\__ \ /'___\/\`'__\\/\ \ /\ '__`\\ \ \/ /',__\
/\ \L\ \ /\ \__/\ \ \/ \ \ \\ \ \L\ \\ \ \_ /\__, `\
\ `\____\\ \____\\ \_\ \ \_\\ \ ,__/ \ \__\\/\____/
\/_____/ \/____/ \/_/ \/_/ \ \ \/ \/__/ \/___/
\ \_\
\/_/

_ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( L )( o )( o )( n )( e )( y ) ( M )( e )( r )( c )( h )( a )( n )( t )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/

__________________________________________________ __________________
|Directions |
|Set Public Chat to 'Hide' or 'Friends' and Trade/Compete to 'On' |
|Enter your message in line 40. |
|_________________________________________________ ___________________|}


program LooneyMerchant;

{.Include SRL/SRL.Scar}
{.include srl\srl\extended\xtext.scar}
{.include srl\srl\misc\trade.scar}

Const
Message1 = 'Text Goes Here'; //Enter the message you want to say




procedure autotype;
begin
TypeSend(Message1);
wait(2000);
end;


var
xx,yy,accepttradetab:integer;
xa,ya,tradeop1:integer;

procedure DeclareBMPS;
begin
accepttradetab := BitmapFromString(19, 13, 'z78DA33301805A380D' +
'6C01989A48F5DF845686717ADED1D281BF193C4E8A29D1F9D E91E' +
'AA83D14600263E17DE');
tradeop1 := BitmapFromString(2, 1, '800080BBAE92');

end;









Procedure FindBMPS;
begin

if (FindBitmap(accepttradetab,xx,yy)) then
autotype;


if(FindBitmap(tradeop1,xa,ya))then
GetTraderName;



end;

begin
DeclareBMPS;
repeat
wait(1300)
autotype;
FindBMPS;
until(false)
end.