Results 1 to 5 of 5

Thread: Help with a smiple flash game script please?!

  1. #1
    Join Date
    Apr 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Help with a smiple flash game script please?!

    So basically I'm just learning to script in Simba. I'm currently creating a few small scripts for some simple, mouse only flash games.

    However, I'm having trouble with one of my scripts.

    The game (/begamer.com/flash-game/22600/monkey-dinner) consists of seating monkeys for food.. You click a monkey in the queue, then click on one of 3 empty seats (or an empty one out of the three).

    So for this i created a procedure that uses colorfind to locate a monkey that is in the queue, and then a procedure that would seat them (also using colorfind, it would search for a brown color on the stool that IS vissible when a monkey ISNT sitting down). however, my script will select the monkey in the queue but will not seat it. the script does nothing after selecting a monkey in the queue.

    Code:
    program MonkeyGame;
    
    procedure SelectingMonkey; // Uses colorfind to Locate a monkey in the queue.
    var x, y: integer;
    Begin;
        if findcolor (x, y, 2913210, 281, 363, 303, 455) then // Finds monkey in queue
        Begin
        MoveMouse (x, y);
        ClickMouse (x, y, 1); // moves mouse to bear and selects him.
        end;
        end;
    Procedure SelectingTable;
    var x, y: integer;
      Begin;
      if findcolor (x, y, 7066362, 729, 358, 738, 401) then // searches for the brown colour on the furthest away stool that
                                                            // is vissible when the monkey isnt sitting there (ie when the seat is vacant)
        Begin;
        MoveMouse (645, 223);
        ClickMouse (645, 223, 1);//if the seat is vacant, the stool is selected.
      end
        else if not findcolor (x, y, 7066362, 729, 358, 738, 401) then //if not vaccant then...
    
    
      if findcolor (x, y, 9232379, 595, 454, 603, 486) then
          Begin;                 //same description as above but for each stool.
          MoveMouse (x, y);
          ClickMouse (x, y, 1);
          End
          else if not findcolor (x, y, 9232379, 595, 454, 603, 486) then
    
      if findcolor (x, y, 5880557, 459, 565, 472, 593) then
            Begin;
            MoveMouse (x, y);
            ClickMouse (x, y, 1);
            End;
            if not findcolor (x, y, 5880557, 459, 565, 472, 593)then
            SelectingTable; // if no free seat is found, then the procedure is repeated.
      End;
    
    
    
    begin;
    
    Repeat
    SelectingMonkey;
    wait (500);       //This should look for a monkey in the queue untill a monkey shows up.
    SelectingTable;   //and then takes it to a table.
    until (True)
    
    repeat
      SelectingMonkey;    // This should carry out the two procedures but the Selectingtables
      wait(500)           // seems to do nothing.
      SelectingTable;
    until (false);
    end.

    Could some one have a look please? Would be greatly appreciated

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    You sire have an infinite loop and a loop that doesn't loop.


    Simba Code:
    Repeat
    Until(True);  Does no repeating at all since the condition is always "False"


    It's the same as:

    Code:
    do
    {
    } while(false);
    It does it once but as soon as it checks the condition it breaks because while-loops only repeat when the condition is true.

    Your second loop is infinite and you'll be pretty much stuck in that loop.

    Not sure why no one helped you yet since this is Simba code.. should have easy for someone browsing these forums. Fix the standards a bit or wait until I get home to browse from a comp then I can help you.. Until then, I can only point out what seems wrong.
    Last edited by Brandon; 04-30-2013 at 03:34 PM.

  3. #3
    Join Date
    Apr 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks man! I've only been scripting in simba for 2 days so not sure about all of the syntax yet, I just thought it would make sense?

    As I want the script to start when the game does, I thought the script would stop as the on keys aren't in the queue straight away and I have
    Code:
    SelectingMonkey;
    SelectingTable;
    Until (false)
    well it will be false to start with because there is no monkey? (Hope that made sense)

    Any help is appreciated and thanks for taking the time to reply.

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Tomnolan View Post
    Thanks man! I've only been scripting in simba for 2 days so not sure about all of the syntax yet, I just thought it would make sense?

    As I want the script to start when the game does, I thought the script would stop as the on keys aren't in the queue straight away and I have
    Code:
    SelectingMonkey;
    SelectingTable;
    Until (false)
    well it will be false to start with because there is no monkey? (Hope that made sense)

    Any help is appreciated and thanks for taking the time to reply.
    IT would have to be

    Simba Code:
    Repeat
      SelectingMonkey;
      SelectingTable;
    Until (false)

  5. #5
    Join Date
    Apr 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Yer man,I just didn't type It all out, it is that in the OP

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
  •