Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Beginner in Lua (first script)

Featured Replies

Hello, I need to sell more quickly my items from my bag at the hv the idea seemed simple to me basically if I want create a plugin to automatically sell all the green objects at 10 gold at the hv I tested this code but This doesn't work:

using System.Threading.Tasks;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;
using wManager.Events;

public class AutoSellGreenItems : wManager.Plugin.Plugin
{
    public override void Initialize()
    {
        LuaEvents.OnEventsLuaStringWithArgs += OnAuctionHouseShow;
    }

    public void OnAuctionHouseShow(string eventName, List<string> args)
    {
        if (eventName == "AUCTION_HOUSE_SHOW")
        {
            Task.Run(async () => {
                await Task.Delay(5000);
                SellGreenItems();
            });
        }
    }

    public void SellGreenItems()
    {
        foreach (WoWItem item in Bag.GetBagItems())
        {
            if (item.Quality == WoWItemQuality.Green)
            {
                Lua.LuaDoString($@"
                    local bag = {item.BagIndex}
                    local slot = {item.Slot}
                    PickupContainerItem(bag, slot);
                    StartAuction(50000, 50000, 12, 1);");
            }
        }
    }

    public override void Dispose()
    {
        LuaEvents.OnEventsLuaStringWithArgs -= OnAuctionHouseShow;
    }
}

if you could guide me on my errors I would be grateful, thank you in advance!

Edited by Elexir
error

Hello,

Your code can't work it doesn't have the good structure.

Here is some code with a correct structure (although I don't think it works, it would need to be debugged):

using System.Collections.Generic;
using System.Threading;
using robotManager.Helpful;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
using wManager.Wow.Enums;

public class Main : wManager.Plugin.IPlugin
{
    public void Initialize()
    {
        EventsLuaWithArgs.OnEventsLuaStringWithArgs += OnAuctionHouseShow;
    }

    private void OnAuctionHouseShow(string eventName, List<string> args)
    {
        if (eventName == "AUCTION_HOUSE_SHOW")
        {
            Logging.WriteDebug("Auction House is open");
            Thread.Sleep(5000);
            SellGreenItems();
        }
    }

    public void SellGreenItems()
    {
        foreach (WoWItem item in Bag.GetBagItem())
        {
            if (item.GetItemInfo.ItemRarity == (int)WoWItemQuality.Uncommon)
            {
                Logging.WriteDebug($"Selling {item.Name}");
                Bag.PickupContainerItem(item.Name);
                Thread.Sleep(1500);
                AuctionHelpers.StartAuction(50000, 50000, AuctionHelpers.Duration._12H, 1, 1); //Lua.LuaDoString($@"StartAuction(50000, 50000, 12, 1);");
            }
        }
    }

    public void Dispose()
    {
        EventsLuaWithArgs.OnEventsLuaStringWithArgs -= OnAuctionHouseShow;
    }

    public void Settings()
    {
    }
}

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.