Results 1 to 8 of 8

Thread: Need help adding Overloads

  1. #1
    Join Date
    Apr 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help adding Overloads

    Hello,
    Im not a good scripter, but i want to improve myself.
    I want to add Overload support to a fighting script.
    Maybe someone could give me his way to add Overload.
    Sorry for my bad English (German)

    Regards

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Are you scripting in PascalScript or La-pe?

    PascalScript doesn't support overloads, but la-pe does

  3. #3
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Are you scripting in PascalScript or La-pe?

    PascalScript doesn't support overloads, but la-pe does
    Lol. He means overload potions (in rs), not overloads (numbers over 2.1b?).

    It would be difficult to do this if you do not have any pascalscript knowledge. Is the script yours? Could you posts its code?

  4. #4
    Join Date
    Apr 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh yes i mean Overload in Rs.
    Hmm okay. This is not my Script. Its called Based Bandits.
    Hmm are there any tutourials that could be useful for me ?

  5. #5
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Are you scripting in PascalScript or La-pe?

    PascalScript doesn't support overloads, but la-pe does
    Don't feel bad, I was thinking the same thing.


    Ok let's see, adding potion-handling to a script will be done in this process (roughly):

    1) Time to take a sip?
    2) Find the potion in the inventory
    3) Clicking the potion
    4) Resetting a "potion timer"

    I'll let you handle Step 1 & 4, but I'll show you how to do Step 2 & 3.

    For finding an item in the inventory, your best bet is to use DTMs; these are commonly used as their accuracy and simplicity make them very practical. To learn how to make DTMs you can check out one of these tutorials:
    Creating Accurate DTMs
    Yohojo's DTM Tut 1(Item finding with DTMs)

    Now that you've made your DTM of your potion we'll want to find it & click it. I constructed a small example script of how to do this. It's self-explanatory:

    Simba Code:
    {$I SRL/SRL.Simba}

    Var
      Potion: Integer;

    Procedure LoadOurVars;
    begin
      Potion := DTMFromString('YOUR DTM STRING GOES HEREEEEEEE');  //First, let's define our "Potion" DTM
    end;

    Procedure FreeOurDTMs;
    begin
      FreeDTM(Potion);
    end;

    Function ClickPotion: Boolean;
    var
      x,y,PotionSlot: Integer;
    begin
      Result := False;                                             //By default, this function should result False

      if FindDTM(Potion,x,y,MIX1,MIY1,MIX2,MIY2) then              //If our "Potion" DTM is found in the inventory then...
      begin
        PotionSlot := CoordsToItem(X,Y);                           //Convert the X/Y coordinate (that we found the Potion DMT at) into an inventory slot
        MouseItem(PotionSlot, mouse_left);                         //Click the 'PotionSlot' inventory slot with a left-click action
        Result := True;                                            //We found & clicked the potion, so let's make this function result True (success!)
      end;
    end;

    begin
      SetupSRL;

      LoadOurVars;  //We MUST load our Potion DTM or the script won't know what to look for!

      if ClickPotion then
        Writeln('Took a sip of our potion!')
      else
        Writeln('No potion found...');

      FreeOurDTMs;  //ALWAYS free the DTMs after we're done using them (usually this is called when a script is stopped
    end.

    I hope that helps.

    Edit:
    Also as a small reference, MIX1 = Inventory X1, MIY1 = Inventory Y1, MIX2 = Inventory X2, MIY2 = Inventory Y2. Just in case you were wondering.
    Last edited by Flight; 10-30-2012 at 02:12 AM.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  6. #6
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    not overloads (numbers over 2.1b?).
    That's overflow, not overload

    And yeah, I thought the same as Zyt3x too
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  7. #7
    Join Date
    Apr 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @Flight ,
    Thanks for your help.
    I will have a try adding Overloads.
    Best Regards

    Edit: I had a look on yohojos Dtm Tutourial, and i have a Question.
    When i want to add a potion like Overload flask to my script, there are six different items ( Overload flask (6),
    Overload flask (5), Overload flask (4), Overload flask (3), Overload flask (2) and Overload flask (1)).

    Do i have to make Dtms of all of them ? Or only of the Overload flask(1)

    Thanks
    Last edited by jpwesemann; 11-02-2012 at 08:15 AM.

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

    Default

    Okay,
    I now made a Dtm of an Overload flask (1) and if i try it on other overload Flasks like (2,3,4) it will always find it. So i guess it is right

    Im now trying to add these to the script

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
  •