Results 1 to 6 of 6

Thread: AddToBelt function

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

    Default AddToBelt function

    Very simple, maybe some scripters might want this. It'll added a specific tool (defined as a string) to your tool belt. If you already have that tool in your tool belt it'll return false. Just use as AddToBelt('Lobster pot');.

    I don't have all of the tools defined in the function but it's quite obvious on how to add the rest. Anyways, it should cover the most popular tools.

    Simba Code:
    Function AddToBelt(What: String): Boolean;
      var
        X,Y,Slot,T,Tool: Integer;
      begin
        Result := False;
        case What of
          'Tinderbox':
            Tool := DTMFromString('mggAAAHicY2NgYDjMxMBwAojPAPFpID4IxDuA+CVQ7hkQPwLiN0D8AYpNdNgZoiPDgSwmFMwFJEEYHTDiwBAAAIohC78=');
          'Barbarian rod':
            Tool := DTMFromString('mggAAAHicY2NgYChlYmDIAOJKIC4C4hwgzgXi+0C5d0B8D4ifAfFbIH4IxDaB0Qy6hiZAFhMK5gKSIIwOGHFgCAAAnhsJrw==');
          'Knife':
            Tool := DTMFromString('mbQAAAHicY2VgYHBkYmBwAGJzILYBYk8g5mJkYOAFYjEgFgZiBiBurK5miLfjBXKY4JgLSIIwMmDEgsEAAB4RA9I=');
          'Hammer':
            Tool := DTMFromString('mggAAAHicY2NgYLBnYmCwBmIPIDYHYisg9gXiUEYGhhAg9gTiWCCOA2IvILbT5GTw0Odi8PfxAepmgmMuIAnDyIARB4YAAPp7BZI=');
          'Chisel':
            Tool := DTMFromString('mbQAAAHicY2VgYNjNxMBwCIi3A/E+IN4BxCKMDAzsQCwIxSB+iDkPg56ODlAHExxzAUkQRgaMWDAYAADN9QVM');
          'Small fishing net':
            Tool := DTMFromString('mbQAAAHicY2VgYDjCxMBwGIjPAvFJIN4HxAaMDAwmQKwDxBZQtqOxKoORugxQBxMccwFJEEYGjFgwGAAAEFgGGQ==');
          'Fishing rod':
            Tool := DTMFromString('mbQAAAHicY2VgYOhjYmCYCMQLgHg2EE8FYl5GBgY+IGYCYi4gFgZiPR0dhjB7HqAOJjjmApIgjAwYsWAwAACBxQSE');
          'Harpoon':
            Tool := DTMFromString('mggAAAHicY2NgYMhmYmAoBuIKIE4G4iwgLgViLkYGhv9A+T9ALA5k8zFC2Gbq7Awerq4M/j4+QB4THHMBSRhGBow4MAQAAPbNCBs=');
          'Lobster pot':
            Tool := DTMFromString('mrAAAAHic42BgYJjFBMETgXgaEM8D4iVAPAXKfg5U8xGIPwDxJyB+C8RPgfgdEL8E4jALHjBmYGBCwcnx8WDMBeSBMDqAiTMSwDAAAK4jD/k=');
        end;

        if ExistsItemDTM(Tool, X, Y) then
        begin
          Slot := CoordsToItem(X, Y);
          MouseItem(Slot, False);
          Wait(RandomRange(20, 75));
          WaitOption('toolbelt', 300);
        end else
          Result := False;

        MarkTime(T);
        repeat
          if (TimeFromMark(T) > 3000) then
            break;
          if not ExistsItemDTM(Tool, X, Y) then
            break;
          if FindBlackChatMessage('already on') then
            break;
        until(false)

        Result := not ExistsItemDTM(Tool, X, Y);

        FreeDTM(Tool);
      end;

    Kinda useless but if you want it, take it.

    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..."


  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    lowercase(what), and lowercase them or use consts like TOOL_TINDERBOX

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

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

    Default

    Quote Originally Posted by Dgby714 View Post
    lowercase(what), and lowercase them or use consts like TOOL_TINDERBOX
    The only constants I've found (for items and such) were bitmaps. I didn't know SRL already had DTMs for such tools, where are they located? Also I wonder if they're up to date.

    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..."


  4. #4
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    The only constants I've found (for items and such) were bitmaps. I didn't know SRL already had DTMs for such tools, where are they located? Also I wonder if they're up to date.
    Not what I ment. I ment creating TOOL_* constants for use with the function.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  5. #5
    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 Flight View Post
    The only constants I've found (for items and such) were bitmaps. I didn't know SRL already had DTMs for such tools, where are they located? Also I wonder if they're up to date.
    What he means is that 'What' does not equal 'what'. So it's best to make the variable What lowercase (What := Lowercase(What)) do avoid errors by the scripter.

    And it's best to create and use constants for such tools to further avoid scripter error.
    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 |

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

    Default

    Quote Originally Posted by Dgby714 View Post
    Not what I ment. I ment creating TOOL_* constants for use with the function.
    Oh okie dokie.

    Yeah Daniel I know about lower case. Thanks for the heads up.

    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..."


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
  •