Results 1 to 9 of 9

Thread: Really Quick Question!

  1. #1
    Join Date
    Jun 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Really Quick Question!

    Hey guys, I am trying to write some code and I am just wondering how do you write code to use the left and right arrow keys in pascal? I want to use the arrow keys all the way on the right of the keyboard. (left-#4 and right-#6). I just need really simple code using readkey and all that ( I was thinking maybe a case statement somewhere in there?)..
    Last edited by goodlife; 06-05-2012 at 10:53 PM.

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Do you mean like this?
    Simba Code:
    Procedure HandleArrowKeys;
    Begin
      KeyDown(VK_Left);
      Wait(100);
      KeyUp(VK_Left);
    End;

    This will hold down the left arrow key for 100 ms and then release the key. You can also use VK_right, VK_up, and VK_down

  3. #3
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    VK_NUMPAD4 // (Right)
    VK_NUMPAD2 // (Down)
    VK_NUMPAD6 // (Left)
    VK_NUMPAD8 // (Up)
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  4. #4
    Join Date
    Jun 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Actually, I know the simba commands are different...do you think you could show me the regular commands?

  5. #5
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    I'm fairly certain the ones Sex posted are universal.

    Edit: Hex values are 62, 64, 66 and 68, respectively.
    Last edited by Runaway; 06-05-2012 at 10:47 PM.

  6. #6
    Join Date
    Jun 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No I meant the way I could actually get it to work in a program..

  7. #7
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

  8. #8
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Simba Code:
    Program New;
      {$DEFINE SRL5}
      {$i SRL/srl.simba}

    Procedure ToggleScreenAngle(TotalKeys, WaitPeriod: Integer);
    Var
      clicks, i: Integer;
    Begin
      Repeat
        Begin
        i:= Random(4);
          Case (i) Of
           1:  begin
                 KeyDown(VK_Left);
                 Wait((WaitPeriod)+random(50));
                 KeyUp(VK_Left);
                 IncEx(clicks, 1);
               End;
           2:  Begin
                 KeyDown(VK_Right);
                 Wait((WaitPeriod)+random(50));
                 KeyUp(VK_Right);
                 IncEx(clicks, 1);
               End;
           3:  Begin
                 KeyDown(40);
                 Wait((WaitPeriod)+random(50));
                 KeyUp(40);
                 IncEx(clicks, 1);
               End;
           4:  Begin
                 KeyDown(38);
                 Wait((WaitPeriod)+random(50));
                 KeyUp(38);
                 IncEx(clicks, 1);
               End;
          end;
        End;
      Until (clicks = TotalKeys)
        If (clicks = TotalKeys) Then
        Wait(100+Random(50));
        MakeCompass('W');
        SetAngle(SRL_ANGLE_HIGH);
    End;

    Begin
      SetupSRL;
      ToggleScreenAngle(27, 250);
    End.

    E: ^ That was a little fun thing I made, however I think this is easier to understand;

    Simba Code:
    Program New;
      {$DEFINE SRL5}
      {$i SRL/srl.simba}

    Procedure MoveArrowKeys;
    Begin
      KeyDown(VK_Left);
      Wait(100);
      KeyUp(VK_Left);
    End;

    Begin
      SetupSRL;
      MoveArrowKeys;
    End.

    E2: If you're trying to move the RS compass, there's better ways to go about / pre-made ways to move your RS compass angel already in simba

    E3: This is all for PascalScript, used within simba, not Pascal.
    Last edited by Le Jingle; 06-05-2012 at 10:55 PM.

  9. #9
    Join Date
    Jun 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks so much Le Jingle! Exactly what I was looking for. Yeah the simba code is a little tough to translate as I am new to it. If anyone knows regular pascal coding, feel free to contribute!
    Last edited by goodlife; 06-05-2012 at 10:57 PM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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