Results 1 to 4 of 4

Thread: Help! Learning To Script

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

    Default Help! Learning To Script

    Hey,

    Trying to learn to script, starting with a basic colour find then click.

    -------------------------------------------------------------------------



    program FindColor
    var
    x, y: Integer;

    const
    OreColor= 0;//Color!

    Procedure FindColor

    begin
    if(FindColor(x,y,OreColor,0,0,600,600)) then
    begin
    getmousepos(x,y)
    clickmouse(x,y,true)
    wait(2000+1000)
    end;
    end;

    Procedure StartFind

    begin
    FindColor
    repeat
    FindColor
    until(false)
    end.

    -----------------------------------------------------------------------

    Well Why Doesnt It Work.

    Please Help.

    Cheers In Advance

  2. #2
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    423
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    add me to msn

  3. #3
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    First off, is 0 you're actual ore color or just a placeholder for now? You need to use the eyedropper to get the actual color of the ore.


    Second, you have no movemouse procedure. The script goes from finding the coords with findcolor ---> to clicking. But there was never actually a command to move TO those coords before trying to click there!

  4. #4
    Join Date
    Sep 2006
    Posts
    161
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Your current script does:
    Find the color
    Get the current mouse coordinates into x,y
    Click x,y which are your current mouse coordinates

    The mouse never moved. Don't reset x,y as they contain your target coordinates. Also, use SRL's Mouse and MMouse. Most other mouse procedures are (relatively more) detectable.

    So, to reiterate, you should do

    reset x,y to starting point
    FindColor into x,y your color
    MMouse to x,y
    check IsUpText
    Mouse x,y click

    EDIT:

    Or, as SCAR-script
    SCAR Code:
    program FindColor

    {.include SRL/SRL.scar}

    const
      TheOreColor = 12345;

    function ClickOre: Boolean;
    begin
      if (FindMainColor(x,y,TheOreColor,5,True)) then
      begin
        MMouse(x,y,5,5);
        if (IsUpText('Mine')) then
        begin
          Mouse(x,y,5,5);
          Flag;
          Wait(100+random(200));
          result := true;
        end
      end
    end;

    I deviated from your ideas a bit to demonstrate some things.
    Use SRL, it simplifies stuff by placing wrappers around code you no longer need to write.
    Use if-reasoning. Make sure what you think is true actually is.
    Use a function that returns True after completing, and recall it if it's False.
    I recommend you look up Mouse (click), MMouse (move cursor), and Flag (wait for the red minimap flag while walking to go away), IsUpText:Boolean (what's the mouse-over message?).


    Wow. I've been away quite a while. Real life, yea, way unpredictable. Sorry, y'all, if I've caused any inconvenience.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 16
    Last Post: 08-22-2008, 09:48 AM
  2. AutoTalker Learning Script.
    By turbobk in forum Outdated Tutorials
    Replies: 4
    Last Post: 02-19-2008, 11:10 PM
  3. learning to script
    By takeNout in forum OSR Help
    Replies: 1
    Last Post: 09-03-2007, 09:36 AM
  4. Learning To Script
    By journalfrench in forum OSR Help
    Replies: 15
    Last Post: 02-21-2007, 03:12 AM
  5. Replies: 3
    Last Post: 11-15-2006, 04:03 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
  •