Results 1 to 19 of 19

Thread: need function.

  1. #1
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default need function.

    Hey can anyone, give me some functions like with some explanation would be nice.

    1.right-click and click option with specific text.

    2.then i already have found x,y cords, i need to move and click mouse

    3. do until inventory is no more item (smithing, no more ores).

    4. do until inventory is full (mining wc etc.).

    5. anythink usefull i should know.


    I have checked some srl, include files, some of them are explainded in description not very well though, require more values then explained, you have to have some experience from start to use them..

    I would like to create some scripts. for public/member use.

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    1.
    ClickMouse2(mouse_Right);
    WaitOption('abc', 1000);
    2.
    Mouse(x,y,rx,ry,mouse_left);
    3.
    while not InvEmpty do
    begin
    Actions;
    end;
    4.
    while not InvFull do
    5.
    Even the names are quite self-explanatory actually, the description in the include is quite well commented usually.
    You need to check out the tutorial sections, many recommended yohojo's vids for beginners.

    Good luck!

  3. #3
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    1.
    ClickMouse2(mouse_Right);
    WaitOption('abc', 1000);
    2.
    Mouse(x,y,rx,ry,mouse_left);
    3.
    while not InvEmpty do
    begin
    Actions
    end;
    4.
    while not InvFull do
    5.
    You need to check out the tutorial sections, many recommended yohojo's vids for beginners.

    Good luck!
    hey, if i'm, sure this one will work until inventory goes empty, and i need sth like i have 28 silver/gold ores gonna smelth them and get like 28 bars. that makes inventory full. but with other kind of items. not sure though
    Code:
    3. 
    while not InvEmpty do
    begin
    Actions
    end;
    Gonna check tuts, though quite much of tutorials are outdated.

  4. #4
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    hey, if i'm, sure this one will work until inventory goes empty, and i need sth like i have 28 silver/gold ores gonna smelth them and get like 28 bars. that makes inventory full. but with other kind of items. not sure though
    Code:
    3. 
    while not InvEmpty do
    begin
    Actions
    end;
    Gonna check tuts, though quite much of tutorials are outdated.
    Not sure what you mean but if you are superheating gold there won't be any change in InvCount?
    Probably a loop like
    for i:=1 to 28 do
    begin
    //some spell casting procedure
    //MouseItem(i, mouse_Left);
    //some loop etc to wait for magic tab to reappear?
    end;

    Probably need to add antirandom/antiban to the loop as well.

    Also tutorials dont get 'outdated', i'd say 99% of them are still relevant, maybe only slight change in procedure names. When you see a Scar tutorial, it is most likely applicable to Simba as well.

  5. #5
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Also tutorials dont get 'outdated', i'd say 99% of them are still relevant, maybe only slight change in procedure names. When you see a Scar tutorial, it is most likely applicable to Simba as well.
    I see, cuz i have tried some out, but script do not want to compile in most cases. Going to check that too.

    Thank you for help.

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    I see, cuz i have tried some out, but script do not want to compile in most cases. Going to check that too.

    Thank you for help.
    Probably to do with it defining scar instead of simba rather than the codes.
    Try changing
    {$I SRL/SRL.scar}
    to
    {$I SRL/SRL.simba}

    http://villavu.com/forum/showthread.php?t=58935
    This tutorial could be good to start with. I won't expect any compilation error from it. Try do a search for the error if you do

  7. #7
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Probably to do with it defining scar instead of simba rather than the codes.
    Try changing
    {$I SRL/SRL.scar}
    to
    {$I SRL/SRL.simba}

    http://villavu.com/forum/showthread.php?t=58935
    This tutorial could be good to start with. I won't expect any compilation error from it. Try do a search for the error if you do
    I just tried to do at video tut (with cut tree script tut)
    SCAR Code:
    Function ChopTree:boolean;
    var x, y, invChange, t: Integer;

    begin
      invChange:= InvCount + 1;
      If FindObjCustom(x, y, ['hop'], ['1252893','1779750'], 10) then
        Begin
           Case Random(1) of // Random cut method 50/50
           0:Mouse(x, y, 5, 5, true); //left click
           1:Begin
              Mouse(x, y, 5, 5, false);//right click + choose option
              WaitOption('Chop', 500);
             End;
           end;

           Repeat
              MarkTime(t);
              Antiban;
              Wait(100 + Random(50));
              if(InvCount=InvChange) then
              WriteLn('We got one!');
           until (InvCount=InvChange) OR (TimeFromMark(t) > 6000);
        end;
    end;

    But getting output like this one. Mouse not even goes to color though.
    (If i use findcolortolerance it works good.
    Code:
    SRL Compiled in 0 msec
    Error: Exception: Type Mismatch at line 20
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]

  8. #8
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Which line is line 20? I dont see anything wrong with syntax except that
    1. You need the fix the standard http://villavu.com/forum/showthread.php?t=60288
    2. MarkTime(t) should be called outside the repeat loop
    3.
    if(InvCount=InvChange) then
    begin
    WriteLn('We got one!');
    Break; //just break it here instead of checking again
    end;

  9. #9
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Which line is line 20? I dont see anything wrong with syntax except that
    1. You need the fix the standard http://villavu.com/forum/showthread.php?t=60288
    2. MarkTime(t) should be called outside the repeat loop
    3.
    if(InvCount=InvChange) then
    begin
    WriteLn('We got one!');
    Break; //just break it here instead of checking again
    end;
    SCAR Code:
    If FindObjCustom(x, y, ['hop'], ['1252893','1779750'], 10) then

    EDIT: Strange thing is that i dont use bitmaps at code right row.
    EDIT2: I did with marktime, as was in tutorial http://www.youtube.com/watch?v=qfumZ...ure=plpp_video of YoHoJo he put it inside the loop, and it worked for him well

  10. #10
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    SCAR Code:
    If FindObjCustom(x, y, ['hop'], ['1252893','1779750'], 10) then
    Compiles fine for me? You have declared the x,y correctly as integers so i cant see what could go wrong. Do you have the latest SRL? Tools>Check for update. I presume that's a very old function (since it's made by starblaster) that has probably never been altered so that's probably not the problem too.

    EDIT:
    Quote Originally Posted by Laimonas171 View Post
    Strange thing is that i dont use bitmaps at code right row.
    what do you mean by this? do you have something hidden to the right of line 20?

    Also tell me at what time yohojo actually call MarkTime in the loop, not going watch the whole vid

  11. #11
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Also tell me at what time yohojo actually call MarkTime in the loop, not going watch the whole vid
    Video at current time:
    http://www.youtube.com/watch?feature...Wrm_DE#t=2047s

    I have mean output, at debugbox is
    Code:
    Error: Exception: Type Mismatch at line 20
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
    it says that some of dtms, btmps are not freed, and i dont use DTM, Btmps at the time.

    EDIT:Probably that srl, because I'm using one miner at the time, and opened new Simba, in new window. and as you asked about to check updates, extensions aren't enabled. strange 'cuz in first windows where mining scripts works, it works well, and updates are done there.
    EDIT2: Did update still same output.


    Edit3: if i try only to compile script it compiles well, but if i Start the script only then it gives output like that

    EDIT4: Maybe full script will help to solve problem?
    SCAR Code:
    program test;
    {$i SRL/SRL.simba}

    Procedure Antiban;
    Begin
        Case Random(3) of
            0:Begin GameTab(23); end;
            1:Begin GameTab(12); end;
            2:Begin GameTab(1); end;
            3:Begin GameTab(11); end;
        end;
    end;


    Function ChopTree:boolean;
    var x, y, invChange, t: Integer;

    begin
      invChange:= InvCount + 1;
      If FindObjCustom(x, y, ['hop'], ['1252893', '1779750'], 10) then
        Begin
           Case Random(1) of // Random cut method 50/50
           0:Mouse(x, y, 5, 5, true); //left click
           1:Begin
              Mouse(x, y, 5, 5, false);//right click + choose option
              WaitOption('Chop', 500);
             End;
           end;
           MarkTime(t);
           Repeat

              Antiban;
              Wait(100 + Random(50));
              if(InvCount=InvChange) then
              begin
              WriteLn('We got one!');
              end;
           until (InvCount=InvChange) OR (TimeFromMark(t) > 6000);
        end;
    end;



    //-----
    begin
    SetupSRL;
    ChopTree;
    end.

  12. #12
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    Video at current time:
    http://www.youtube.com/watch?feature...Wrm_DE#t=2047s

    I have mean output, at debugbox is
    Code:
    Error: Exception: Type Mismatch at line 20
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
    it says that some of dtms, btmps are not freed, and i dont use DTM, Btmps at the time.

    EDIT:Probably that srl, because I'm using one miner at the time, and opened new Simba, in new window. and as you asked about to check updates, extensions aren't enabled. strange 'cuz in first windows where mining scripts works, it works well, and updates are done there.
    Woah he must be drunk while making that tutorial! I'll inform him about that.

    By calling MarkTime in the loop you are resetting the timing every loop so it will NEVER break out. The reason why it worked is because it has another breaking condition InvCount=InvChange, which breaked the loop.
    Basically just use what i taught you, even a noob like me beats a drunk man

    The unfreed dtm/bitmap is probably from SRL's global bitmap/dtms that are loaded when you call SetupSRL. But that's the result of a premature termination, not the cause of it. I presume that the Simba wasn't loaded properly somehow, try wait awhile for the plugin/extensions to load before compiling the script.

  13. #13
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Woah he must be drunk while making that tutorial! I'll inform him about that.

    By calling MarkTime in the loop you are resetting the timing every loop so it will NEVER break out. The reason why it worked is because it has another breaking condition InvCount=InvChange, which breaked the loop.
    Basically just use what i taught you, even a noob like me beats a drunk man

    The unfreed dtm/bitmap is probably from SRL's global bitmap/dtms that are loaded when you call SetupSRL. But that's the result of a premature termination, not the cause of it. I presume that the Simba wasn't loaded properly somehow, try wait awhile for the plugin/extensions to load before compiling the script.

    Ok some more "MAGIC", if I turn of completely Simba, and start it on again. AND I DO NOT select any window/client And start "Start" button, mouse starting to search for color on script field. but if I select runescape client, it gives same output as before

    Edit:Checked standarts, mainly for If sentence (because of line 20) but also some other, looks good.

  14. #14
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    Ok some more "MAGIC", if I turn of completely Simba, and start it on again. AND I DO NOT select any window/client And start "Start" button, mouse starting to search for color on script field. but if I select runescape client, it gives same output as before
    Oh i'm being blind. The TIntegerArray shouldn't be a TSA. Remove the ''. Kind of strange why it didn't cause compiling error though.

    If FindObjCustom(x, y, ['hop'], [1252893, 1779750], 10) then

  15. #15
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Oh i'm being blind. The TIntegerArray shouldn't be a TSA. Remove the ''. Kind of strange why it didn't cause compiling error though.

    If FindObjCustom(x, y, ['hop'], [1252893, 1779750], 10) then
    I see, now it click on tree but i still get same output after first click
    Code:
    SRL Compiled in 16 msec
    Exception: Range check error at line 576
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
    starting to think that my simba is cursed.

    edit: also in new tab opens Glabals.simba
    with
    SCAR Code:
    (*
    GetFightBarTPA
    ~~~~~~~~~~~

    .. code-block:: pascal

        Function GetFightBarTPA(SearchArea: TBox): TPointArray;

    Used in various fighting functions, including srl_InFight

    .. note::

        by Narcle

    Example:

    .. code-block:: pascal


    *)
    Highlighted line with word "Example:" , quite makes no sense to me

  16. #16
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Laimonas171 View Post
    I see, now it click on tree but i still get same output after first click
    Code:
    SRL Compiled in 16 msec
    Exception: Range check error at line 576
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
    starting to think that my simba is cursed.
    Uhm the script you posted has only 48 lines? If the error is pointing to a new file forced open what's the file?
    I often get annoying strange bugs in simba too so don't give up

    EDIT:
    i'm not sure if it caused the error, but change the Random(1) to Random(2), so that it actually generates 2 cases.

  17. #17
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Uhm the script you posted has only 48 lines? If the error is pointing to a new file forced open what's the file?
    I often get annoying strange bugs in simba too so don't give up
    i did edit at previous post about file.. and i'm sure file are latest. because i just did update again.

    edit: FALSE
    Code:
    ********************************************************************************
    
    Failed to update plugins! Restart Simba and update before starting a script.
    
    ********************************************************************************
    Plugins Update ERROR: Kill recieved from Updater.
    No SRL update available.
    i have no active script, i turn on simba > SRL > check for UPDATE, and each time get this.

    i have runned it as admin as well.


    EDIT reinstalled simba, works quite well now. thanks for help for now btw rep+ u

  18. #18
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Laim, I really suggest copying your scripts into a person folder and re-installing Simba, You seem to have a bad luck bug :P

    Once Simba is re-installed take the steps slowly Make sure you havent forgotten anything. Remember the extensions need to be activated and then updated. After that RESTART SIMBA

    If successful you may get a few bugs and whatnot from missing lib files so just google them and whatnot.

    If not then test Simba if it is missing files etc add them then Restart.

    You should also check you aren't blocking the updater. Last but not least I'm not sure if this works but go to your Simba Folder and post the latest ErrorLog.

    It should look like this:


    edit: Sorry didn't see you had an Edit and then I went off on one xD

  19. #19
    Join Date
    Nov 2008
    Location
    Norway, Alesund
    Posts
    924
    Mentioned
    0 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    Laim, I really suggest copying your scripts into a person folder and re-installing Simba, You seem to have a bad luck bug :P

    Once Simba is re-installed take the steps slowly Make sure you havent forgotten anything. Remember the extensions need to be activated and then updated. After that RESTART SIMBA

    If successful you may get a few bugs and whatnot from missing lib files so just google them and whatnot.

    If not then test Simba if it is missing files etc add them then Restart.

    You should also check you aren't blocking the updater. Last but not least I'm not sure if this works but go to your Simba Folder and post the latest ErrorLog.

    It should look like this:


    edit: Sorry didn't see you had an Edit and then I went off on one xD
    hehe, thank you anyways! looks like it works now so I'm ready to take another step in learning process

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
  •