• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • [PB] Using item in your bag

    Discussion in 'Honorbuddy Forum' started by meetjobrown, Oct 24, 2012.

    1. meetjobrown

      meetjobrown New Member

      Joined:
      Mar 13, 2011
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0
      I just made a down and dirty profile that prospects all ghost iron and kyparite. It crafts BOE's, and sends different materials to my enchanter, banker, and alchemist. The only issue I have run into, is to craft the blue BOE's, I need the serpent eyes. I have the sparkling shards in my bag, and I don't know how to get PB to use the item to turn them into serpent eyes. If someone knows how to please let me know. Also, I would like it to repeat until the sparkling shards in my bag is less then 10, basically make every serpent eye possible.

      If this is in the wrong section I apologize.
       
    2. Toney001

      Toney001 New Member

      Joined:
      Oct 12, 2011
      Messages:
      1,206
      Likes Received:
      5
      Trophy Points:
      0
      Code:
      <CustomAction Code="Lua.DoString(&quot;UseItemByName(90407)&quot;);" />
      There. You're welcome :)
       
    3. meetjobrown

      meetjobrown New Member

      Joined:
      Mar 13, 2011
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0
      Thanks for the quick reply!
       
    4. meetjobrown

      meetjobrown New Member

      Joined:
      Mar 13, 2011
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0
      I put this in my xml and it only happened once. So I tried putting an if statement in like this:

      <If Condition="InbagCount(90407) &gt; 10" IgnoreCanRun="True">
      <CustomAction Code="Lua.DoString(&quot;UseItemByName(90407)&quot;);" />
      </If>

      This also only runs once, even if I have 40+ sparkling shards in my bag. I copied and pasted code from other PB files because I am trying to teach myself to write my own. Im just assuming this would be the correct way.
       
    5. Toney001

      Toney001 New Member

      Joined:
      Oct 12, 2011
      Messages:
      1,206
      Likes Received:
      5
      Trophy Points:
      0
      Sorry, I read you were making your own profiles so I assume you just needed the code to use it.

      Code:
          <While Condition="InbagCount (90407) &gt;= 10" IgnoreCanRun="False">
            <CustomAction Code="Lua.DoString(&quot;UseItemByName(90407)&quot;);" />
            <WaitAction Condition="false" Timeout="1500" />
          </While>
      That will use it for as long as you have 10 shards or more.
      Hope it helps :)

      EDIT: Just to clarify, generally the IF action will run once, and the WHILE action will run for as long as the condition is true, that's why the code you tried was only doing it once.

      If you open the bot config (with PB selected of course) and click on help, a small tutorial will pop up. I'm sure you'll find if useful.
      I believe it's in a RTF file inside the PB directory as well.
       
      Last edited: Oct 25, 2012
    6. meetjobrown

      meetjobrown New Member

      Joined:
      Mar 13, 2011
      Messages:
      8
      Likes Received:
      0
      Trophy Points:
      0
      Thanks again. Still learning how to write them.
       
    7. Toney001

      Toney001 New Member

      Joined:
      Oct 12, 2011
      Messages:
      1,206
      Likes Received:
      5
      Trophy Points:
      0
      Np, hope you get it to work the way you want :).
       
    8. Corny

      Corny New Member

      Joined:
      Jan 8, 2011
      Messages:
      306
      Likes Received:
      5
      Trophy Points:
      0
      Code:
      <!--Tidy Bags by LiquidAtoR-->[INDENT][B]<Settings DefaultValue="false" Type="Boolean" Name="[U]use something[/U]" Summary="Set this to true if you want to use something" Category="[/B][B]use something[/B][B]" Global="False" Hidden="False" />[/B]
      [B]<Declaration Code="Stopwatch sw = new Stopwatch();" />[/B]
      [B]<If Condition="(bool)Settings[&quot;[U]use something[/U]&quot;] &amp;&amp; HasItem([U][ItemID][/U]) &amp;&amp; (GetItemCount([U][ItemID][/U]) &gt;=10) &amp;&amp; (Me.FreeNormalBagSlots &gt;=1)" IgnoreCanRun="True">
      [/B][/INDENT]
      [INDENT=2][B]<CustomAction Code="[/B][/INDENT]
      [INDENT=3][I]if (!sw.IsRunning) 
          {
          sw.Start();
          }
      if (sw.Elapsed.TotalSeconds > 1)
          {
          StyxWoW.SleepForLagDuration();
          Lua.DoString("UseItemByName([/I][U][B][ItemID][/B][/U][I])");
          StyxWoW.SleepForLagDuration();
          }
      while (LootTargeting.LootFrameIsOpen)
          {
          StyxWoW.SleepForLagDuration();
          if (sw.Elapsed.TotalSeconds >= 6)
              {
              break;
              }
          }
      sw.Reset();
      sw.Start();[/I]
      [/INDENT]
      [INDENT=2][B]" />[/B]
      [/INDENT]
      [INDENT][B]</If>[/B][/INDENT]
      
       

    Share This Page