July 17, 20241 yr 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); }
July 23, 20241 yr 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.
July 24, 20241 yr 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