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.

Compilation error in wrobot: Unexpected characters $. Need help.

Featured Replies

 I am using the $@ method to include content in the string, but when I run Wrobot, it prompts "Unexpected characters $". Is it that Wrobot does not support compilation in this way? Or is there a problem with the code? Below is my code, thank !

public static void DeleteItems(string itemName, int leaveAmount = 0)
    {
        var itemQuantity = ItemsManager.GetItemCountByNameLUA(itemName) - leaveAmount;

        if (string.IsNullOrWhiteSpace(itemName) || itemQuantity <= 0)
        {
            return;
        }

        string luaToDelete = $@"
            local itemCount = {itemQuantity}; 
            local deleted = 0; 
            for b=0,4 do 
                if GetBagName(b) then 
                    for s=1, GetContainerNumSlots(b) do 
                        local itemLink = GetContainerItemLink(b, s) 
                        if itemLink then 
                            local itemString = string.match(itemLink, ""item[%-?%d:]+"");
                            local _, stackCount = GetContainerItemInfo(b, s);
                            local leftItems = itemCount - deleted; 
                            if ((GetItemInfo(itemString) == ""{itemName}"") and leftItems > 0) then 
                                if stackCount <= 1 then 
                                    PickupContainerItem(b, s); 
                                    DeleteCursorItem(); 
                                    deleted = deleted + 1; 
                                else 
                                    if (leftItems > stackCount) then 
                                        SplitContainerItem(b, s, stackCount); 
                                        DeleteCursorItem(); 
                                        deleted = deleted + stackCount; 
                                    else 
                                        SplitContainerItem(b, s, leftItems); 
                                        DeleteCursorItem(); 
                                        deleted = deleted + leftItems; 
                                    end 
                                end
                            end 
                        end 
                    end 
                end 
            end
        ";
        Lua.LuaDoString(luaToDelete);
    }
  • Author
On 7/24/2024 at 5:11 AM, Droidz said:

Hello,

WRobot uses an older version of the C# compiler that does not support string interpolation with the '$' syntax for variables like {varname}. However, you can use '@' for multiline strings.

Thank you, I will try.

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.