Log in

View Full Version : Help with Merchanter



Dspider0
06-11-2007, 02:26 AM
help. im new to scar, but i tried writing a simple script and im having trouble


program New;
{.include SRL/SRL.scar}

var
q:integer;

procedure declareq;
Begin
q = 0
end;

procedure talk;
begin
case (random(3)) of
0: TypeSend('flash1:selling 5k air runes, 15ea!!');
1: TypeSend('flash2: selling 5k air runes for 15gp each!!!');
2: TypeSend('flash3: selling 5k air runes, 75k');
end;
wait (500+random(500));
q = q+1
end;

procedure mainloop;
begin
declareq;
repeat
talk;
until q > 10;
end.

i says
Line 9: [Error] (17670:3): Assignment expected in script D:\Program Files\SCAR 2.03\Scripts\merchanter.scar

I want it to perform the typing procedure 10 times, i think i did some stuff right =/. I wrote it from scratch just now

i would appreciate help

Santa_Clause
06-11-2007, 02:33 AM
q = 0

This should be q := 0;

q = q+1

This should be q := q+1;

procedure mainloop;
begin
declareq;
repeat
talk;
until q > 10;
end.


Only the end in the mainloop should have an end with a full stop. All other ends have a semi colon. Remove the procedure part and it'll work.

Here's the working version:

program New;
{.include SRL/SRL.scar}

var
q:integer;

procedure declareq;
Begin
q := 0;
end;

procedure talk;
begin
case (random(3)) of
0: TypeSend('flash1:selling 5k air runes, 15ea!!');
1: TypeSend('flash2: selling 5k air runes for 15gp each!!!');
2: TypeSend('flash3: selling 5k air runes, 75k');
end;
wait (500+random(500));
q := q+1;
end;

begin
declareq;
repeat
talk;
until q > 10;
end.

Dspider0
06-11-2007, 02:44 AM
tyvm SantaClause, i wasn't too far off, but ty for fixing it and helping, much appreciated.

can i make a writeln that will say the value of Q whenever it finishes the procedure "talk"?

i just tried this and it worked


program New;
{.include SRL/SRL.scar}

var
q:integer;

procedure declareq;
Begin
q := 0;
end;

procedure talk;
begin
case (random(3)) of
0: TypeSend('flash1:selling 5k air runes, 15ea!!');
1: TypeSend('flash2: selling 5k air runes for 15gp each!!!');
2: TypeSend('flash3: selling 5k air runes, 75k');
end;
wait (500+random(500));
q := q+1;
end;

procedure progressreport;
begin
writeln ('The script has spoke '+inttostr(q)+' times');
end;

begin
declareq;
repeat
talk;
progressreport;
until q > 10;
end.

Santa_Clause
06-11-2007, 02:58 AM
Sure you can, but try a ClearDebug; in your mainloop after Talk;. That way you wont have 10 progress reports.