Results 1 to 13 of 13

Thread: I did the tutorial... now i'm stuck

  1. #1
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default I did the tutorial... now i'm stuck

    I did the tutorial to say hello world in the debug box , i want to add more phrases can someone help me?


    SCAR Code:
    program test;

    const
    Message1='Hello world!';

    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1);
    end;


    begin
     repeat
       hello;
     until(false)
    end.

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    SCAR Code:
    program test;
     
    const
    Message1='Hello world!';
    Message2 = 'Hello to you to';

    procedure Hello;
    begin
      wait(1000)
      Writeln(Message1);
      Writeln(Message2);
    end;
     
     
    begin
     repeat
       hello;
     until(false)
    end.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  3. #3
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thank you , i did the whole process overnew , that was my fault
    Thank You

  4. #4
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program test;

    const
    Message1 = 'Hello !';
    Message2 = 'Hello to you to';
    message3 = 'Thank you ! ';

    procedure Hello;
    begin
      wait (2000)
      Writeln(Message1);
      wait (3000)
      Writeln(Message2);
      wait (3500)
      writeln(message3);
     
    end;


    begin
     repeat
       hello;
     until(false)
    end.

  5. #5
    Join Date
    Oct 2006
    Location
    I'm a figment of your imagination
    Posts
    422
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Random Message Selector

    To make it do the messages randomly:

    SCAR Code:
    program WriteRandomly;

    //Below are all messages put into constants
    const
      Message1 = 'This is message one! C00l!';
      Message2 = 'Yet another message... LOL!';
      Message3 = 'WTF, this is crazy... I should stop with teh messages now.';
      Message4 = 'Okay, last message here!';

    begin
      //Endless loop so it will display a message every second
      repeat
      //Many IF-loops grouped into one... Read the tut on cases for more info
      Case Random(4) of
      0 : Writeln('No message assigned!');
      1 : Writeln(Message1);
      2 : Writeln(Message2);
      3 : Writeln(Message3);
      4 : Writeln(Message4);
      end;
      Wait(1000); //Wait a second until it will display the next one
      until(false);  //Endless loop ends
    end.

    It's been a while... but I'm BACK!!!

  6. #6
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you , i am starting out on this easy stuff to make better ones later I need to start somewhere
    I like scar , I like StarBlaster 100 , I like stressminer ,
    I don't like FAGEX!

    http://starblaster.freehostia.com/stress/matteo.png

  7. #7
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    please check this script , it's quite simple but it needs improvements ,

    -not all keys are recorded.
    -bad report.
    -keys are recorded too fast sometimes.

    SCAR Code:
    program New;
    begin
      repeat



        if(IsKeyDown('a'))then
          AddToReport('A down')
          sleep(50)
         
        if(IsKeyDown('b'))then
          AddToReport('B down')
          sleep(50)
         
        if(IsKeyDown('c'))then
          AddToReport('C down')
          sleep(50)
         
        if(IsKeyDown('d'))then
          AddToReport('D down')
          sleep(50)
         
        if(IsKeyDown('e'))then
          AddToReport('E down')
          sleep(50)
         
        if(IsKeyDown('f'))then
          AddToReport('F down')
          sleep(50)
         
        if(IsKeyDown('g'))then
          AddToReport('G down')
          sleep(50)
         
        if(IsKeyDown('h'))then
          AddToReport('H down')
          sleep(50)
         
        if(IsKeyDown('i'))then
          AddToReport('I down')
          sleep(50)
         
        if(IsKeyDown('j'))then
          AddToReport('J down')
          sleep(50)
         
        if(IsKeyDown('k'))then
          AddToReport('K down')
          sleep(50)
         
        if(IsKeyDown('l'))then
          AddToReport('L down')
          sleep(50)
         
        if(IsKeyDown('m'))then
          AddToReport('M down')
          sleep(50)
         
        if(IsKeyDown('o'))then
          AddToReport('O down')
          sleep(50)
         
        if(IsKeyDown('p'))then
          AddToReport('P down')
          sleep(50)
         
        if(IsKeyDown('q'))then
          AddToReport('Q down')
          sleep(50)
         
        if(IsKeyDown('r'))then
          AddToReport('R down')
          sleep(50)
         
        if(IsKeyDown('s'))then
          AddToReport('S down')
          sleep(50)
         
        if(IsKeyDown('t'))then
          AddToReport('T down')
          sleep(50)
         
        if(IsKeyDown('u'))then
          AddToReport('U down')
          sleep(50)
         
        if(IsKeyDown('v'))then
          AddToReport('V down')
          sleep(50)
         
        if(IsKeyDown('w'))then
          AddToReport('W down')
          sleep(50)
         
        if(IsKeyDown('x'))then
          AddToReport('X down')
          sleep(50)
         
        if(IsKeyDown('y'))then
          AddToReport('Y down')
          sleep(50)
         
        if(IsKeyDown('z'))then
          AddToReport('Z down')
          sleep(50)
         
         
      until(False);
     
    end.
    I like scar , I like StarBlaster 100 , I like stressminer ,
    I don't like FAGEX!

    http://starblaster.freehostia.com/stress/matteo.png

  8. #8
    Join Date
    Sep 2006
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try not to put everything in the main loop. Make it a procedure. If the "then" statement is multi-line, use begin and end;. Use semicolons after every line, except after "then" and some other stuff. And whats the difference between wait and sleep? I never figured that out. I think this may be case sensitive, and I think there may be a better procedure for this.
    SCAR Code:
    program New;
    procedure DetectKeys;
    begin
      repeat
        if(IsKeyDown('a'))then
        begin
          AddToReport('A down');
          sleep(50);
        end;
        if(IsKeyDown('b'))then
        begin
          AddToReport('B down');
          sleep(50);
        end;
     ...
        if(IsKeyDown('z'))then
        begin
          AddToReport('Z down');
          sleep(50);
        end;
      until(False);
    end;

    begin
      DetectKeys;
    end.

  9. #9
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    one of my first scar scripts was a keylogger...
    you know you can detect keys like enter if you do this

    SCAR Code:
    IsKeyDown(chr(13))
    chr(13) means the keyboard character code, 13 is the code for enter
    Join the Official SRL IRC channel. Learn how to Here.

  10. #10
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, heres a much shorter version. I commented like everything to help you understand .

    Code:
    program Blah;
    
    var
      I : Integer;
     
    begin
     while True do          { Constantly running until terminated }
      for I:= 1 to 255 do   { do the following proccess from I being 1 to 255 }
       if(IsKeyDown(Chr(I)))then  { As variable I increases, it checks to see if the character value of I is being pressed }
         Writeln('Key ' + IntToStr(I) + ', also known as "' + Chr(I) + '" has been pressed'); { If keyboard character value of variable I is pressed, output it to the debug box }
    end.
    EDIT : To work on, try making the script output once for every key press instead of flooding the debug box at every tap of a key.

    Also, I see in one of your scripts, an error . Oh noes:

    Code:
      Case Random(4) of
      0 : Writeln('No message assigned!');
      1 : Writeln(Message1);
      2 : Writeln(Message2);
      3 : Writeln(Message3);
      4 : Writeln(Message4);
      end;
    Random(4) returns a value between 0 and 3, it's just the was it works. To make yours work you should make it "case Random(5) of".

  11. #11
    Join Date
    Dec 2006
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    heh
    Matteoke will go crazy

  12. #12
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OMG it's hard now i need to fix 2 scripts on 5 different ways lol

    Thank you for all the help
    I like scar , I like StarBlaster 100 , I like stressminer ,
    I don't like FAGEX!

    http://starblaster.freehostia.com/stress/matteo.png

  13. #13
    Join Date
    Dec 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OMG it's hard now i need to fix 2 scripts on 5 different ways lol

    Thank you for all the help
    I like scar , I like StarBlaster 100 , I like stressminer ,
    I don't like FAGEX!

    http://starblaster.freehostia.com/stress/matteo.png

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. stuck on error
    By yakkyigooconroy in forum OSR Help
    Replies: 3
    Last Post: 01-22-2008, 09:11 PM
  2. Stuck
    By RS Rebel in forum OSR Help
    Replies: 9
    Last Post: 07-03-2007, 09:27 AM
  3. stuck at my autofighter
    By the scar noob in forum OSR Help
    Replies: 1
    Last Post: 01-05-2007, 03:50 PM

Posting Permissions

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