Discussion in 'Script Releases' started by Shaba, Feb 14, 2007.

Thread Status:
Not open for further replies.
  1. Shaba

    Shaba Active Member

    Messages:
    135
    Use this when you're done fighting and you need to repair and sell cash loot. This will repair all items, and sell any items that are flagged by the game as cash loot.

    Target the general merchant and run the script.


    GenMerchant.iss

    [ SEE LAST POST FOR SCRIPT ]
    Last edited: Mar 12, 2007
  2. Amadeus

    Amadeus The Maestro Staff Member

    Messages:
    8,265
    Updated to use "RepairAll" (MUCH better than repairing each item individually!)

    Code (Text):

    function main()
    {
      declarevariable finishplat int script 0
      declarevariable finishgold int script 0
      declarevariable finishsilver int script 0
      declarevariable finishcopper int script 0
      declarevariable copperbegin int script 0
      declarevariable copperfinish int script 0
      declarevariable diff int script 0
      call Repair
      call Sell
    }
     
    function Repair()
    {
      variable int i = 1
        call SetCopper
        copperbegin:Set[${Return}]
      Merchant:Begin[Repair]
      wait 5
      Merchant:RepairAll
      wait 5
      call LastStep "Repair"
      Merchant:End        
    }
     
    function Sell()
    {
      variable int i = 1
        call SetCopper
        copperbegin:Set[${Return}]
      Merchant:Begin[BuySell]
      wait 5
      do
      {
        if ${Me.Inventory[${i}].Keyword2.Find[Cash]}
         {
             Me.Inventory[${i}]:Sell[${Me.Inventory[${i}].Quantity}]
             wait 5
          }
        i:Inc
      }
      while ${Me.Inventory[${i}].ID(exists)}
      i:Set[1]
      do
      {
        if ${Me.Inventory[${i}].Keyword2.Find[Cash]}
         {
             Me.Inventory[${i}]:Sell[${Me.Inventory[${i}].Quantity}]
             wait 5
          }
          i:Inc
      }
      while ${Me.Inventory[${i}].ID(exists)}
      wait 5
      call LastStep "Sell"
      Merchant:End        
    }


    function SetCopper()
    {
      variable int tempc
      tempc:Set[${Me.Copper}]
      tempc:Inc[${Me.Silver}*100]
      tempc:Inc[${Me.Gold}*10000]
      tempc:Inc[${Me.Platinum}*1000000]
      return ${tempc}
    }

    function LastStep(string temp)
    {
      call SetCopper
      copperfinish:Set[${Return}]
      diff:Set[${copperfinish} - ${copperbegin}]
      finishplat:Set[${diff}\\1000000]
      finishgold:Set[${diff}%100000\\10000]
      finishsilver:Set[${diff}%10000\\100]
      finishcopper:Set[${diff}%100]
      echo ${temp}: ${finishplat}p ${finishgold}g ${finishsilver}s ${finishcopper}c
    }
     
Thread Status:
Not open for further replies.

Share This Page