Results 1 to 5 of 5

Thread: New to pascal and scripting, need a little brain storming.

  1. #1
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default New to pascal and scripting, need a little brain storming.

    Hello, I'm trying to create a simple power miner using the unoffical 2007 include and my code is working fine but I have no idea how to prevent the script from clicking a rock if i'm already mining it without being able to detect animations and color bots can't do that well so any ideas?

    Also here is my code if that helps you any.

    Code:
    Program test;
    
    {$I SRL/SRL.Simba}
    {$I P07Include.Simba}
    
    var cx, cy: integer;
    
    var count: integer;
    
    
    
    begin
    
    SetupP07Include;
    
    repeat
    if P07_FindObj(cx, cy, 'Mine Rocks', 2305614, 5) then
    ClickMouse2(mouse_left);
    writeln('Found rocks, clicked them, waiting 1.5s');
    wait(1500);
    count := 0;
    if P07_FindObj(cx, cy, 'Mine Rocks', 2305614, 5) = false then
    writeln('cant find rocks');
    count := count+1;
    
    until count = 5;
    
    writeln('count was 5, no rocks for 7+ seconds. stopped');
    
    end.
    EDIT: Also does the FindObj function return a random part of the object each call? It looks like it does but i'm not sure, I don't know if I need to randomize the pixels to avoid clicking the exact pixel over and over.
    Last edited by Khal Drogo; 02-25-2013 at 08:51 PM.

  2. #2
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    There is pixel shift but I'm not sure if it works with 07 or if there is an invcount function in the P07 include then you could have it wait until the invcount increases by one
    Current Project: Retired

  3. #3
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Gucci View Post
    There is pixel shift but I'm not sure if it works with 07 or if there is an invcount function in the P07 include then you could have it wait until the invcount increases by one
    Ahh so check how many items are in the inventory, save that number in a variable then only click if it's changed since the last check?

    If I'm wrong could you write some pseudo code I could look at?

  4. #4
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    You have it fairly well right with your idea on how to check your inventory.

    I do (think) PixelShift will work in 07, and (hopefully) IsMoving can be a backup in case someone ended up mining your rock before you and you don't end up waiting for your set time.

  5. #5
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by Khal Drogo View Post
    Ahh so check how many items are in the inventory, save that number in a variable then only click if it's changed since the last check?

    If I'm wrong could you write some pseudo code I could look at?
    That's right.

    1. Get an initial count of the inventory.
    2. Repeat checking the inventory.
    3. Have the it repeat checking until the count increases by one.
    Current Project: Retired

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
  •