Results 1 to 2 of 2

Thread: Help With include

  1. #1
    Join Date
    Oct 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help With include

    My problem is that i have two scripts, one i use to Hold the procedures and one i use to execute, however when i run the code, or change the names of the functions i call(like change "Procedure M;" then calling it as "Main;") does not give me an error.
    It just compiles and says its successful.
    Here is the code for both files

    First the Main
    SCAR Code:
    {.include ChatProcedures.scar}
    program Try1;


    Procedure Main;
    begin
    Spam(10, false, 'Trade');
    writeln('--------------------');
    writeln('Case 0 happened:' + IntToStr(x) + 'times.');
    writeln('Case 1 happened:' + IntToStr(y) + 'times.');
    writeln('Case 2 happened:' + IntToStr(z) + 'times.');
    end;

    begin
    ClearDebug;
    Main;
    end.

    And now the Procedures(They dont really have a purpose, i just havent coded for a while and i was practicing, theres still a couple things i could make faster in there[For statements])

    Sorry it snakes for so long. =)

    SCAR Code:
    var
    i,r,x,y,z : integer;
    Chat : array [1..3] of String;
    Trade : array [1..3] of String;

    Procedure LoadSpeech;
    begin
    Chat[1]:= 'Hows the Weather?';
    Chat[2]:= 'Oh Shoot!';
    Chat[3]:= 'Stupid Game...';
    Trade[1]:= 'Trade?';
    Trade[2]:= 'Sellin Lobbies!';
    Trade[3]:= 'hurry up...';
    end;

    Procedure Spam(RepeatTimes : integer; InfRepeat : boolean; ChatOrTrade : string);
    begin
    LoadSpeech;
         if ChatOrTrade = 'Chat' then
         begin
            if InfRepeat = false then
            begin
            i:=0;
            x:= 0;
            y:=0;
            z:=0;
              repeat
              r := Random (3)
                    Case r of
                    0 : begin
                        writeln(Chat[1] + IntToStr(x));
                        x:= x+1;
                        end;

                    1 : begin
                        writeln(Chat[2] + IntToStr(y));
                        y:= y+1;
                        end;

                    2 : begin
                        writeln(Chat[3] + IntToStr(z));
                        z:= z+1;
                        end;
                    end;
              i:= i +1
              wait(100);
              until(i = RepeatTimes);
            end;
            if InfRepeat = true then
            begin
            x:= 0;
            y:= 0;
            z:= 0;
              repeat
              r := Random (3)
                    Case r of
                    0 : begin
                        writeln(Chat[1] + IntToStr(x));
                        x:= x+1;
                        end;

                    1 : begin
                        writeln(Chat[2] + IntToStr(y));
                        y:= y+1;
                        end;

                    2 : begin
                        writeln(Chat[3] + IntToStr(z));
                        z:= z+1;
                        end;
                    end;
              wait(100);
              until(false);
            end;
         end;
         if ChatOrTrade = 'Trade' then
         begin
            if InfRepeat = false then
            begin
            i:=0;
            x:= 0;
            y:=0;
            z:=0;
              repeat
              r := Random (3)
                    Case r of
                    0 : begin
                        writeln(Trade[1] + IntToStr(x));
                        x:= x+1;
                        end;

                    1 : begin
                        writeln(Trade[2] + IntToStr(y));
                        y:= y+1;
                        end;

                    2 : begin
                        writeln(Trade[3] + IntToStr(z));
                        z:= z+1;
                        end;
                    end;
              i:= i +1
              wait(100)
              until(i = RepeatTimes);
            end;
            if InfRepeat = true then
            begin
            x:= 0;
            y:= 0;
            z:= 0;
              repeat
              r := Random (3)
                    Case r of
                    0 : begin
                        writeln(Trade[1] + IntToStr(x));
                        x:= x+1;
                        end;

                    1 : begin
                        writeln(Trade[2] + IntToStr(y));
                        y:= y+1;
                        end;

                    2 : begin
                        writeln(Trade[3] + IntToStr(z));
                        z:= z+1;
                        end;
                    end;
              wait(100);
              until(false);
             end;
         end;
    end;

    begin
    Spam(2,false,'chat');
    end.

    Result:
    Successfully compiled (26 ms)
    Successfully executed

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR is successfully compiling the include, because it contains a main loop.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with my include
    By fert in forum OSR Help
    Replies: 9
    Last Post: 10-27-2008, 11:12 AM
  2. Include Help, Please?
    By File in forum OSR Help
    Replies: 22
    Last Post: 03-20-2008, 10:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •