Having a bit of a problem with my first script

Discussion in 'Scar/Simba Help' started by chris4815, Jan 2, 2010.

Having a bit of a problem with my first script
  1. Unread #1 - Jan 2, 2010 at 4:11 PM
  2. chris4815
    Joined:
    Jan 2, 2010
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    chris4815 Newcomer

    Having a bit of a problem with my first script

    Okay I'm new to this so please don't shoot me down in flames.

    So I have been trying to create a script which allows my character on a 2d game to meditate. On the game you meditate by pressing arrow keys which are randomly being chosen and displayed above your characters head.

    So while looking for a way to create something that would do it for me I came across the findcolor() in SCAR and saw that you could define a box to check for a certain colour and I thought this was perfect.(btw the coordinates or what ever for the top left and bottom right of the box keep having to be changed when I check if there covering where they should be, any reason why that should be happening?)

    If anybody could give it a quick glance and tell me with is wrong/needs changing I would be much appreciated.

    Code:
    program test;
    var
    x, y : Integer;
    begin
         wait(50)
         Writeln('Started');
         If(FindColor(x, y, 2831800, 268, 227, 274, 233)=true)then
            Writeln('NORTH');
            KeyDown(24);
            wait(20)
            KeyUp(24);
         If(FindColor(x, y, 2831800, 267, 243, 274,247)=true)then
            Writeln('SOUTH');
            KeyDown(25);
            wait(20)
            KeyUp(25);
         If(FindColor(x, y, 2831800, 276, 233, 280, 240)=true)then
            Writeln('EAST');
            KeyDown(26);
            wait(20)
            KeyUp(26);
         If(FindColor(x, y, 2831800, 260, 232, 266, 241)=true)then
            Writeln('WEST');
            KeyDown(27);
            wait(20)
            KeyUp(27);
    
    
    end.
    
    
     
  3. Unread #2 - Jan 6, 2010 at 6:13 PM
  4. radiclerobby
    Joined:
    Mar 9, 2008
    Posts:
    720
    Referrals:
    0
    Sythe Gold:
    0

    radiclerobby Apprentice
    Banned

    Having a bit of a problem with my first script

    key downs are fail use
    sendarrowwait(char,time);

    chars only have 4 difernt possible values 0,1,2,3
    0 is up
    1 is right
    2 is down
    3 is left

    time is how long to hold down the arrow
    10 would be 10 miliseconds ect and you dont have to use writeln to tell you which arrow it would be sending would just have morefor your script to do also using a dtm and making it search the whole area for the dtm would fix your problem hope i helped and good luck
     
  5. Unread #3 - Jan 20, 2010 at 7:38 PM
  6. IKillYou
    Joined:
    Jan 16, 2010
    Posts:
    44
    Referrals:
    0
    Sythe Gold:
    0

    IKillYou Member

    Having a bit of a problem with my first script

    Code:
    program Meditate;
    var
      x, y : Integer;
      
    begin
         Wait(50);
         Writeln('Started');
         if(FindColor(x, y, 2831800, 268, 227, 274, 233) = True)then
           begin
            Writeln('NORTH');
            SendArrowWait(0, 20);
           end;
         if(FindColor(x, y, 2831800, 267, 243, 274,247) = True)then
           begin
            Writeln('SOUTH');
            SendArrowWait(2, 20);
           end;
         if(FindColor(x, y, 2831800, 276, 233, 280, 240) = True)then
           begin
            Writeln('EAST');
            SendArrowWait(1, 20);
           end;
         if(FindColor(x, y, 2831800, 260, 232, 266, 241) = True)then
           begin
            Writeln('WEST');
            SendArrowWait(3, 20);
           end;
    end.
    
    This should work if
    NORTH = UP
    EAST = RIGHT
    SOUTH = DOWN
    WEST = LEFT

    Just PM me if you need any help. :)
     
< Dumb Question about Scars Possabilitys | how to use for statements in scar? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site