• Log in or sign up for an account here: https://www.sythe.org/login

Having a bit of a problem with my first script

chris4815

Newcomer
Joined
Jan 2, 2010
Sythe Gold
0
Messages
2
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.
 
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
 
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. :)
 
Runescape Gamblingrunescape gambling
Back
Top