Minecraft-Console-Client
Minecraft-Console-Client copied to clipboard
I need help pls
A server that i play on has implemented a GUI captcha. Is there a way to create a c# script that clicks a specific item in Gui? Type of the item depends on name of gui.
Unfortunately there is no template for this. You can either write your own C# script and work with the inventory classes or utilize inventory handling and try to solve this captcha with /inventory manually.
Unfortunately there is no template for this. You can either write your own C# script and work with the inventory classes or utilize inventory handling and try to solve this captcha with
/inventorymanually.
Sadly i cant code in C#, and the whole point of creating the script is not doing it manually, but i can code in java, also how would u make the script urself ? (Maybe ur idea will help make it on my own)..
Currently this repository is a bit cluttered, since the major .Net 5 rework (from .Net Framework 4.8) got merged.
Although it is not really necessary for you to know, here is a video that explains what this means.
Normally you would start with Visual Studio and create a new ChatBot in the corresponding folder that inherits from ChatBot.cs.
Make sure to change branch to previous, as the ChatBot.cs got removed in the latest commit.
I also do not really know what the plan behind this is tbh...
Then you need to add a using MinecraftClient.Inventory; to the top. By inheriting from Chatbot.cs you get some functions to work with inventories, which are explained by comments (example). Apart from that you can read through inventory.cs (provides the usual command handling with /inventory) and the inventory folder.
You need to read through some code, but it is pretty similar to Java, so reading itself should not pose a big challenge.
This function returns all inventories as Container class (Keep in mind that container ID 0 is the player inventory). If you look at the attributes you can see that every container has a Title and a dictionary Items. Just compare the title to item.DisplayName() until you find the correct slot. And then it is only moving this item (here you can take a look into inventory.cs again).
thx ill try my best
Make sure to change branch to previous, as the ChatBot.cs got removed in the latest commit.
@Daenges They are moved to Scripting folder.
also how to preform command like /inventory from c# code ??
also how to preform command like /inventory from c# code ??
You don't. Use the appropriate functions gained from using the inventory namespace.
Above I provided sections where you see example usages or explanations for functions that may be useful. If you look into the /inventory file to see example calls.
oh ok
i get this: [MCC] [Script] Script 'RepairStoneGenerator.cs' failed to run (LoadError). [MCC] [Script] System.InvalidOperationException: ID expected
I can not debug it currently. As an advice: Try to open it in Visual Studio and create a new class or paste your script into the TestBot.cs (without the head, only the content of your inheriting class into the existing one). There you have more options to debug. Remember to use inventory and add the testbot to the loading list to make it start.
Everything works perfectly, just last question, how to, using c# code, click a inventory slot.
I'd like to achieve the same effect as /inventory container click <slot>, oh and how to preform /inventory container close ?
Amazing, how to get the handler ?, cuz im lookin at https://github.com/MCCTeam/Minecraft-Console-Client/blob/master/MinecraftClient/Scripting/ChatBot.cs and i see this: //Handler will be automatically set on bot loading, don't worry about this, idk what to do..
( to execute handler.CloseInventory(container.ID);)
Sorry for keeping you waiting. If you search through the Chatbot functions you see that there is an own implementation for closing and clicking. See different window actions.
Edit: Whoops - messed the links up.
hey, ive written the bot, but it says that[MCC] Script failed to clean-up idk what to do
hey, ive written the bot, but it says that
[MCC] Script failed to clean-upidk what to do
That is a normal warning, it should work normally if you don't have a compilation error.
hey, ive written the bot, but it says that
[MCC] Script failed to clean-upidk what to doThat is a normal warning, it should work normally if you don't have a compilation error.
Discussion was continued in #2204
I guess that wraps up this Issue. I'll close it in favor of that one.