Results 1 to 6 of 6

Thread: [Simba] Script stops instead of infinite while loop !

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

    Default [Simba] Script stops instead of infinite while loop !

    It's not the first time it happens. Script stops instead of while(true) loop, without any error or warning. It runs for some time, but after like 2h I come back and I see it stopped.

    I have very simple script for a flash game:

    Simba Code:
    begin
      Init();
      while (true) do
      begin
          RegenHandler();
          sleep(8000);
      end;

    end.

    In theory script should run forever. There is no 'terminatescript()' inside a RegenHandler, so the only possibility is that it could stop at error - but there was no error massage.

    so I'm like WTF?


    @edit

    Ok, I found it in Simba console:


    What the hell is that?


    It's when you forcefully stop script with red cross - it's not relevant to my problem
    Last edited by bg5; 10-12-2016 at 12:36 AM.

  2. #2
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    Any more info like the simba version you're running and the RegenHandler code?
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

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

    Default

    Quote Originally Posted by Harrier View Post
    Any more info like the simba version you're running and the RegenHandler code?
    simba 1.2.0 ,but it used to happen in the past. The whole script is here:

    Simba Code:
    program new;
    {$include mkex.simba}
    {$i OpenTesseract.simba}
    /////////////////////////////////
    //Config:
    const BATTLE_GEAR = 5;
    REGEN_GEAR = 1;

    /////////////////////////////////
    var s:string;
    IHFilter: TTesseractFilter;
    procedure Init();
    begin
      mk.Init();
      _Tesseract_Setup();
      IHFilter := TTesseractFilter([4, 4, [False, 20, TM_Mean]]);
    end;

    procedure SwitchGear(no:byte);
    begin
       mk.ClickMouse(200, 531);
       sleep(200);
       mk.ClickMouse(167, 445);
       sleep(300);
       mk.ClickMouse(762,395+(no-1)*30);
       sleep(1000);
       mk.ClickMouse(777, 70);
       sleep(1000);
    end;

    procedure RegenHandler();
    var s:string;
    var changeFlag : boolean;
    var sa: TStringArray;
    begin
        s := Tesseract_GetText( 64, 350,103, 364,IHFilter ,'1234567890:');
        ExplodeWrap(':',s,sa);
        if (strToIntDef(sa[0],99) = 0)and (strToIntDef(sa[1],99)<20) then
          changeFlag := TRUE;


        if (not changeFlag) then
        begin
          s := Tesseract_GetText( 64, 374,103, 388,IHFilter ,'1234567890:');
          ExplodeWrap(':',s,sa);
          if (strToIntDef(sa[0],99) = 0)and (strToIntDef(sa[1],99)<20) then
            changeFlag := TRUE;
        end;

        if changeFlag then
        begin
          SwitchGear(REGEN_GEAR);
          sleep(23000);
          SwitchGear(BATTLE_GEAR);
        end;
    end;

    begin
      Init();
      while (true) do
      begin
          RegenHandler();
          //mk.ClickKey(VK_1);
          sleep(8000);
      end;

    end.



    @edit

    Sometimes this script ends with "Successfully executed" massage. Sometimes without any massage.
    I have completely no idea what's happening.
    Last edited by bg5; 10-12-2016 at 12:39 AM.

  4. #4
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    Quote Originally Posted by bg5 View Post
    simba 1.2.0 ,but it used to happen in the past. The whole script is here:

    Simba Code:
    program new;
    {$include mkex.simba}
    {$i OpenTesseract.simba}
    /////////////////////////////////
    //Config:
    const BATTLE_GEAR = 5;
    REGEN_GEAR = 1;

    /////////////////////////////////
    var s:string;
    IHFilter: TTesseractFilter;
    procedure Init();
    begin
      mk.Init();
      _Tesseract_Setup();
      IHFilter := TTesseractFilter([4, 4, [False, 20, TM_Mean]]);
    end;

    procedure SwitchGear(no:byte);
    begin
       mk.ClickMouse(200, 531);
       sleep(200);
       mk.ClickMouse(167, 445);
       sleep(300);
       mk.ClickMouse(762,395+(no-1)*30);
       sleep(1000);
       mk.ClickMouse(777, 70);
       sleep(1000);
    end;

    procedure RegenHandler();
    var s:string;
    var changeFlag : boolean;
    var sa: TStringArray;
    begin
        s := Tesseract_GetText( 64, 350,103, 364,IHFilter ,'1234567890:');
        ExplodeWrap(':',s,sa);
        if (strToIntDef(sa[0],99) = 0)and (strToIntDef(sa[1],99)<20) then
          changeFlag := TRUE;


        if (not changeFlag) then
        begin
          s := Tesseract_GetText( 64, 374,103, 388,IHFilter ,'1234567890:');
          ExplodeWrap(':',s,sa);
          if (strToIntDef(sa[0],99) = 0)and (strToIntDef(sa[1],99)<20) then
            changeFlag := TRUE;
        end;

        if changeFlag then
        begin
          SwitchGear(REGEN_GEAR);
          sleep(23000);
          SwitchGear(BATTLE_GEAR);
        end;
    end;

    begin
      Init();
      while (true) do
      begin
          RegenHandler();
          //mk.ClickKey(VK_1);
          sleep(8000);
      end;

    end.



    @edit

    Sometimes this script ends with "Successfully executed" massage. Sometimes without any massage.
    I have completely no idea what's happening.
    Strange, which RC are you using? RC 1-5 all have a plugin memory leak which might cause the issue. Try joining #simba on rizon or making a issue on github.
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

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

    Default

    I think I've found the answer...

    Simba uses alt+s hotkey to stop the script. And when I run script in the background I do other things on my PC and when I chat of writ on forum in my native language I use combination of alt+s to write special characters

    So yeah, how to change hotkeys ?

  6. #6
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Quote Originally Posted by bg5 View Post
    I think I've found the answer...

    Simba uses alt+s hotkey to stop the script. And when I run script in the background I do other things on my PC and when I chat of writ on forum in my native language I use combination of alt+s to write special characters

    So yeah, how to change hotkeys ?
    https://github.com/MerlijnWajer/Simb...baunit.pas#L80

    I think you need to open Simba.lpr in simba/projects/simba/ in lazarus.
    olly, dgby, neils, or obvs wizzup would know for certain. bother them on irc.

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
  •