jack love 0 Posted July 17 Share Posted July 17 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); } Link to comment https://wrobot.eu/forums/topic/15503-compilation-error-in-wrobot-unexpected-characters-need-help/ Share on other sites More sharing options...
Droidz 2742 Posted July 23 Share Posted July 23 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. Link to comment https://wrobot.eu/forums/topic/15503-compilation-error-in-wrobot-unexpected-characters-need-help/#findComment-69494 Share on other sites More sharing options...
jack love 0 Posted July 24 Author Share Posted July 24 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. Link to comment https://wrobot.eu/forums/topic/15503-compilation-error-in-wrobot-unexpected-characters-need-help/#findComment-69498 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now