Wednesday, 13 July 2011

Code snippets

Loop to check bag items:
function CleanBag(sellprize) for i, item in pairs(inventory.BagSlot) do if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT and settings.profile.options.INV_AUTOSELL_TOSLOT >= item.SlotNumber then if (item:isType("weapons") or item:isType("armor")) and sellprize > item.Worth then printf("Deleting Item: "..item.Name.."\n"); item:delete() end end end end
Mailbox functions Setting up healer and DPS bot

Emailing between Toons, and removing equipment

Player Experience level...experience = memoryReadRepeat("intptr", getProc(), addresses.charExp_address, 0)

Mounting a horse " player:mount(); "

Complete Noob guide to setting up ROMBOT

Creating function to check for equipment to wear/upgrade

Profile code:
<onLoad>
      -- Additional Lua code to execute after loading the profile
      -- and before the bot starts. e.g. You could overwrite profile settings here
      -- like: changeProfileOption("HP_REST", 60);
      inventory:update();

      if(player.Level == 1) then
         openGiftbags1To10(player.Level);
      else
         levelupSkills1To10("loadonly");
      end;
      

      if(player.Class1 == CLASS_SCOUT ) then
         changeProfileOption("ARROW_QUIVER", 2);
      end;
     if( player.Level > 6 ) then
        table.insert(settings.profile.mobs, "Jungb\132r");
        changeProfileOption("TARGET_LEVELDIF_BELOW",3)
     end    

   </onLoad>

   <onDeath>
      -- Additional Lua code to execute on death
      -- pauseOnDeath(); -- Stop the script
   </onDeath>

   <onLeaveCombat>
      -- Additional Lua code to execute after a target is finished

         if(player.Level == 10) then
            __WPL:setForcedWaypointType("TRAVEL")
         end;
         
      inventory:update()
      if( inventory:itemTotalCount(211376) > 0 ) then
            inventory:useItem(211376)
            yrest(1000);
            sendMacro("StaticPopup_OnClick(StaticPopup1, 1);")
    end;
     
    if ( inventory:itemTotalCount(200609) &gt; 45 ) then
      if( player.Level > 7 ) then
         init_exp = RoMScript("GetPlayerExp()")
           if(init_exp > 50) then
                 loadPaths("MeineTwinks/questlogar.xml");
            end;
       end;
    end;           

      if 2 > inventory:itemTotalCount(0) then 
         loadPaths("MeineTwinks/verkaufen.xml")
     end

    lootBodies()

   </onLeaveCombat>

   <onLevelup>
      -- thats a demo for opening the gift bags from Lvl 1-10
      -- and levelup the skills for a new character (mage or priest recommended)
      -- you can delete that lines if you don't want to use that

         -- single skill would be: sendMacro("SetSpellPoint(4,2);");
         -- or levelupSkill(_skillname, _times)
         levelupSkills1To10();

         -- open giftbag and equipt content
         openGiftbags1To10(player.Level);
         
      inventory:useItem(201521)
        yrest(500);
        
     if( player.Level > 6 ) then
        table.insert(settings.profile.mobs, "Jungb\132r");
        changeProfileOption("TARGET_LEVELDIF_BELOW",3)
     end

   </onLevelup>

   <onSkillCast>
      -- Additional Lua code to execute when casting a skill
      -- Note: arg1 contains the skill being used.
      -- i.e. arg1.Name will be the name of the skill being cast.
   </onSkillCast>