Results 1 to 17 of 17

Thread: Making my first script (help)

  1. #1
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Making my first script (help)

    EDIT: This problem is solved, I have another one though, please check my latest post on this thread.

    So I decided to try and make my first script.

    What this will do is, when you start on the 'View Advertisements' page on neobux (a paid to click site) it will find the purple advertisements, click on it, then click the red verification dot and then wait for the ad to load and finally cross the page.

    So far I am stuck at trying to get the script to click the red dot, as I am getting a compiling erorr.

    Simba Code:
    program Neobux;

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 15470554, 236, 221, 848, 348, 10) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 236, 221, 848, 348, 10) then
      begin
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;

    begin
     ClickAd;
     Wait(500);
     Verify;
    end.

    The error I get:

    [Error] (15:1): Identifier expected at line 14
    Compiling failed.

    I'm probably making a huge mess of this and this is my very first attempt at programming, so I welcome any constructive criticism about code formatting etc etc. Going on the site might help you understand my problem easier.

    Script in its current form

    Simba Code:
    program Neobux;

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 148131368, 248, 219, 913, 839, 30) or
         FindColorSpiralTolerance(x, y, 45056, 248, 219, 913, 839, 30) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;
    end;

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 248, 219, 913, 839, 30) then
      begin;
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;
    end;

    procedure ClosePage;
    begin
      KeyDown(17);
      KeyDown(87);
      wait(30);
      KeyUp(87);
      KeyUp(17);
      end;

    procedure Browser;
    var
     x:Integer;
    begin
      OpenWebPage('http://www.neobux.com/m/v/');
      activateclient;
    end;

    begin
     Browser;
     Wait(5000)
     ClickAd;
     Wait(500);
     Verify;
     Wait(20000);
     ClosePage;
    end.
    Last edited by Rawrasaurus; 02-04-2012 at 01:51 PM.

  2. #2
    Join Date
    Jan 2012
    Location
    Minneapolis, Mn
    Posts
    185
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You forgot an end; after ClickAd. Also, after Verify.

  3. #3
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Inception View Post
    You forgot an end; after ClickAd. Also, after Verify.
    Which lines?

  4. #4
    Join Date
    Jan 2012
    Location
    Minneapolis, Mn
    Posts
    185
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  5. #5
    Join Date
    Nov 2011
    Location
    Jozi, South Africa
    Posts
    249
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Smile

    Simba Code:
    program Neobux;

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 15470554, 236, 221, 848, 348, 10) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;
    end;                   // HERE ....

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 236, 221, 848, 348, 10) then
      begin
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;
    end;                   // ... AND HERE!

    begin
     ClickAd;
     Wait(500);
     Verify;
    end.
    Ciao
    NM

  6. #6
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright thanks I got it working perfectly

    Another question I have, is it possible to make Simba open a web URL and then select that window as the focus client?

    EDIT: The goal is to literally make it all happen in one click 'Start'

  7. #7
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I also desperately need to know how to close a tab (Hotkey Ctrl + W) without using co-ordinates (as tab locations change and get smaller when you open a lot). Is there a way to tell the script to hold Ctrl and press W?

  8. #8
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Got those problems solved. New problem.

    Code:
    [Error] (6:11): Semicolon (';') expected at line 5
    Compiling failed.
    Simba Code:
    program Neobux;

    procedure OpenWebPage([url]http://www.neobux.com/m/v/);[/url]

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 43008, 248, 219, 913, 839, 10) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;
    end;

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 236, 221, 913, 839, 30) then
      begin;
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;
    end;

    procedure ClosePage;
    begin
      MoveMouse(1770, -47);
      ClickMouse(1770, -47, 1);
      end;

    begin
     OpenWebPage;
     ClickAd;
     Wait(500);
     Verify;
     Wait(20000);
    end.
    Last edited by Rawrasaurus; 01-31-2012 at 10:55 PM.

  9. #9
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by Rawrasaurus View Post
    I also desperately need to know how to close a tab (Hotkey Ctrl + W) without using co-ordinates (as tab locations change and get smaller when you open a lot). Is there a way to tell the script to hold Ctrl and press W?
    Simba Code:
    Keydown(17); //ctrl
      KeyDown(72); //h
      wait(30);
      Keyup(17);
      Keyup(72);

    Keycodes: http://www.cambiaresearch.com/articl...odes-key-codes

  10. #10
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by beginner5 View Post
    Simba Code:
    Keydown(17); //ctrl
      KeyDown(72); //h
      wait(30);
      Keyup(17);
      Keyup(72);

    Keycodes: http://www.cambiaresearch.com/articl...odes-key-codes
    If I put that into a new script, like:

    Simba Code:
    program Close;

    procedure Terminate;
    begin
     KeyDown(17);
      KeyDown(72);
      wait(30);
      KeyUp(17);
      KeyUp(72);
    end;

    begin
    Terminate;
    end.

    If I set the client to Google Chrome, that should in theory work, right? For some reason it just says:

    Code:
    Compiled successfully in 47 ms.
    Successfully executed.
    Yet nothing happens.

  11. #11
    Join Date
    Nov 2011
    Location
    Jozi, South Africa
    Posts
    249
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Rawrasaurus View Post
    Got those problems solved. New problem.

    Code:
    [Error] (6:11): Semicolon (';') expected at line 5
    Compiling failed.
    This is the offending piece of code.

    Simba Code:
    procedure OpenWebPage([url]http://www.neobux.com/m/v/);[/url]

    Your OpenWebPage procedure needs to look something like this ...

    Simba Code:
    procedure SomeThingOrOther;
    var
       x:Integer (if required)
    begin
       OpenWebPage('http://www.neobux.com/m/v/');
    end;
    Ciao
    NM

  12. #12
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NickMystre View Post
    This is the offending piece of code.

    Simba Code:
    procedure OpenWebPage([url]http://www.neobux.com/m/v/);[/url]

    Your OpenWebPage procedure needs to look something like this ...

    Simba Code:
    procedure SomeThingOrOther;
    var
       x:Integer (if required)
    begin
       OpenWebPage('http://www.neobux.com/m/v/');
    end;
    Thanks I will try that when I get in. Can you check my most recent post on this thread and try and offer a solution for that too?

    Thanks a lot.

  13. #13
    Join Date
    Nov 2011
    Location
    Jozi, South Africa
    Posts
    249
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Smile

    Quote Originally Posted by Rawrasaurus View Post
    Thanks I will try that when I get in. Can you check my most recent post on this thread and try and offer a solution for that too?

    Thanks a lot.
    TBH, I do not know the OpenWebPage procedure or function and what it's arguments should be but if you move the last '[/url]' inside the bracket ')' then it also looks to be a possible option.

    Mind you, IMO - would you not use the [url] tags when it's your intention to present to the reader the option of just clicking on the link to navigate to the webpage ? The argument for OpenWebPage is probably just http://www.neobux.com/m/v/

    What do you think ?
    Last edited by NickMystre; 02-01-2012 at 11:22 AM.
    Ciao
    NM

  14. #14
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NickMystre View Post
    TBH, I do not know the OpenWebPage procedure or function and what it's arguments should be but if you move the last '[/url]' inside the bracket ')' then it also looks to be a possible option.

    Mind you, IMO - would you not use the [url] tags when it's your intention to present to the reader the option of just clicking on the link to navigate to the webpage ? The argument for OpenWebPage is probably just http://www.neobux.com/m/v/

    What do you think ?
    Yeah, the URL seems to have been included automatically when I put it in [simba] tags. The actual script didn't/doesn't contain [url]

    New problem! Here is the code so far:

    Simba Code:
    program Neobux;

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 148131368, 248, 219, 913, 839, 30) or
         FindColorSpiralTolerance(x, y, 45056, 248, 219, 913, 839, 30) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;
    end;

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 248, 219, 913, 839, 30) then
      begin;
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;
    end;

    procedure ClosePage;
    begin
      MoveMouse(1770, -47);
      ClickMouse(1770, -47, 1);
      end;

    procedure Browser;
    var
     x:Integer;
    begin
      OpenWebPage('http://www.neobux.com/m/v/');
    end;

    begin
     Browser;
     Wait(5000)
     ClickAd;
     Wait(500);
     Verify;
     Wait(20000);
    end.

    It seems that after doing the Browser procedure and waiting 5000ms, it will then try to find the colours in the simba client instead. So obviously I need to make it target the client that is the new webpage.

    What do I need to do to make it select a certain client and then continue the script? Thanks

    EDIT: Here's what I'm getting now..

    Code:
    [Hint] (36:2): Variable 'X' never used at line 35
    Compiled successfully in 62 ms.
    Exception: Range check error at line 7
    Last edited by Rawrasaurus; 02-01-2012 at 03:53 PM.

  15. #15
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by Rawrasaurus View Post
    If I put that into a new script, like:

    Simba Code:
    program Close;

    procedure Terminate;
    begin
     KeyDown(17);
      KeyDown(72);
      wait(30);
      KeyUp(17);
      KeyUp(72);
    end;

    begin
    Terminate;
    end.

    If I set the client to Google Chrome, that should in theory work, right? For some reason it just says:

    Code:
    Compiled successfully in 47 ms.
    Successfully executed.
    Yet nothing happens.
    You need to activate client always if you work on browser (you don't need it it SMART)
    Simba Code:
    begin
    activateclient;
    Terminate;
    end;

  16. #16
    Join Date
    Jan 2012
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Here is the script now:

    Simba Code:
    program Neobux;

    procedure ClickAd;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance(x, y, 148131368, 248, 219, 913, 839, 30) or
         FindColorSpiralTolerance(x, y, 45056, 248, 219, 913, 839, 30) then
      begin
        MoveMouse(x, y);
        ClickMouse(x, y, 1);
        Wait(500);
      end;
    end;

    procedure Verify;
    var
      x, y:Integer;
    begin
      if FindColorSpiralTolerance (x, y, 225, 248, 219, 913, 839, 30) then
      begin;
       MoveMouse(x, y);
       ClickMouse(x, y, 1);
      end;
    end;

    procedure ClosePage;
    begin
      KeyDown(17);
      KeyDown(87);
      wait(30);
      KeyUp(87);
      KeyUp(17);
      end;

    procedure Browser;
    var
     x:Integer;
    begin
      OpenWebPage('http://www.neobux.com/m/v/');
      activateclient;
    end;

    begin
     Browser;
     Wait(5000)
     ClickAd;
     Wait(500);
     Verify;
     Wait(20000);
     ClosePage;
    end.

    I'm getting

    Code:
    Error: Exception: Failed to execute  "http://www.neobux.com/m/v/" : 87 at line 40
    help :O

  17. #17
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Try to run simba as administrator.

    Anyway script will not work ,because you open new browser window ,which is not choosen as client by default. After you open game window you need to set it as target. This might help:
    http://docs.wizzup.org/simba/scriptr...l#getprocesses

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
  •