What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[PB] Need help with If Condition

Malvagio

Community Developer
Joined
Aug 17, 2012
Messages
65
Reaction score
12
I am currently writing a profile for Profession Buddy and need some help.

After I finish Prospecting i will have a random number of green gems i will want to make into rings and neck pieces that i can then disenchant.

My problem is buying enough Jeweler Settings.

I am looking for an if then statement to do this in this type of way:

If X <gemname> in bags buy X Jeweler Settings (where x is the number of gems)

More specifically:

If X Jasper in bags buy X Jeweler Settings

If X Alicite, in bags buy X/2 Jeweler Settings

And then do the same for Hessonite and Nightstone

any help would be appreciated.
 
If InbagCount(ItemID) <=> X
Buy Item: Amount: InbagCount(ItemdID)
 
Last edited:
what about the second one where i only need half the settings per gem

and also when i enter that in and change the ids it doesnt compile right.
 
Last edited:
There you go :P You have to edit it for your purpose. and delete the lines where i commented to avoid errors.


PHP:
<Settings DefaultValue="false" Type="Boolean" Name="Use Carnelian" Summary="Should we craft from Carnelians?" Category="JC Crafting" Global="False" Hidden="False" />
  <Settings DefaultValue="false" Type="Boolean" Name="Use Alicite" Summary="Should we craft from Alicites?" Category="JC Crafting" Global="False" Hidden="False" />
  <Settings DefaultValue="false" Type="Boolean" Name="Use Hessonite" Summary="Should we craft from Hessonites?" Category="JC Crafting" Global="False" Hidden="False" />
  <Settings DefaultValue="false" Type="Boolean" Name="Use Jasper" Summary="Should we craft from Jaspers?" Category="JC Crafting" Global="False" Hidden="False" />
  <Settings DefaultValue="false" Type="Boolean" Name="Use Nightstone" Summary="Should we craft from Nightstones?" Category="JC Crafting" Global="False" Hidden="False" />  


<Declaration Code="int settingsAmount;" />

   Calculating how many settings to buy  (DELETE THIS LINE)

  <SubRoutine SubRoutineName="Calc Settings">
    <CustomAction Code="settingsAmount = 0;" />
    <If Condition="(bool)Settings[&quot;Use Alicite&quot;]" IgnoreCanRun="True">
      <CustomAction Code="settingsAmount = settingsAmount + InbagCount (52179) / 2;" />
    </If>
    <If Condition="(bool)Settings[&quot;Use Carnelian&quot;]" IgnoreCanRun="True">
      <CustomAction Code="settingsAmount = settingsAmount + (InbagCount (52177) / 3) * 3;" />
    </If>
    <If Condition="(bool)Settings[&quot;Use Hessonite&quot;]" IgnoreCanRun="True">
      <CustomAction Code="settingsAmount = settingsAmount + InbagCount (52181) / 2;" />
    </If>
    <If Condition="(bool)Settings[&quot;Use Nightstone&quot;]" IgnoreCanRun="True">
      <CustomAction Code="settingsAmount = settingsAmount + InbagCount (52180) / 2;" />
    </If>
    <If Condition="(bool)Settings[&quot;Use Jasper&quot;]" IgnoreCanRun="True">
      <CustomAction Code="settingsAmount = settingsAmount + InbagCount (52182);" />
    </If>
    <CustomAction Code="settingsAmount = settingsAmount - InbagCount (52188);" />
  </SubRoutine>

Add your own If statement and place where you buy the settings NOTE: the "Count" has to be "settingsAmount" (DELETE THIS LINE)
       
<If Condition="Me.MapId == 571" IgnoreCanRun="True">
      <MoveToAction Location="5891.438, 719.4335, 640.3498" MoveType="Location" Pathing="Navigator" Entry="0" />
      <BuyItemAction NpcEntry="28721" Location="5875.724, 714.0495, 643.0885" ItemID="52188" BuyItemType="SpecificItem" Count="settingsAmount" BuyAdditively="True" />
    </If>

Add more rings/necks. this one only containt Alicite Pendant (DELETE THIS LINE)

<SubRoutine SubRoutineName="Craft JC">
    <CallSubRoutine SubRoutineName="Calc Settings" />
    <If Condition="InbagCount (52188) &lt; settingsAmount" IgnoreCanRun="True">
      <CallSubRoutine SubRoutineName="Buy Settings" />
    </If>
    <While Condition="InbagCount (52179) &gt;= 2 &amp;&amp; Me.FreeBagSlots &gt;= 5  &amp;&amp; (bool)Settings[&quot;Use Alicite&quot;]" IgnoreCanRun="False">
      <CastSpellAction RepeatType="Craftable" Repeat="1" Entry="73496" CastOnItem="False" ItemType="Chest" ItemId="0" />
    </While>
</SubRoutine>
 
Back
Top