MCCTeam / Minecraft-Console-Client

Lightweight console for Minecraft chat and automated scripts
https://mccteam.github.io
Other
1.65k stars 398 forks source link

Setting up a bot + libary documentation #999

Closed Frog-Lover-Antony closed 4 years ago

Frog-Lover-Antony commented 4 years ago

I'm really happy with being able to create a bot for minecraft, but currently facing some issues:

  1. I don't know how to configure the bot for AutoFishing (I enable it in the config but nothing happens (and if I don't enable "EntityHandling" I do get an error)).
  2. There is no page with all "MCC." functions for making C scripts, so I have no idea how to make anything more than "sample-script" using MCC.SendText and MCC.LogToConsole.

Adding a full wiki page for all examples (even "how to start your bot") and functions will make MCC much easier to use. thx @ORelio for keeping work on the project

ORelio commented 4 years ago

Hi @Frog-Lover-Antony,

You are probably looking for this section of the documentation. The Script API (all the MCC.<Function> APIs) is defined in CSharpRunner.cs while the ChatBot API is defined in ChatBot.cs.

Regarding AutoFishing, did the autofish instructions not work for you?

Frog-Lover-Antony commented 4 years ago

Oh, seems that I'm not a really good researcher. Thanks for the CSharpRunner.cs note. I did exactly how the instruction says but I don't get "threw a fishing rod" message after /useitem even when i'm standing in water, only fishing rod in inventory, fishing rod is selected. I eventually managed to catch a fish blind only using /useitem

Frog-Lover-Antony commented 4 years ago

@ORelio sorry, of course I had to provide something like: `

Advanced settings

language=en_GB consoletitle=%username%@%serverip% - Minecraft Console Client internalcmdchar=slash # Use 'none', 'slash' or 'backslash' splitmessagedelay=2 # Seconds between each part of a long message botowners=Enderflame # Use name list or myfile.txt with one name per line botmessagedelay=1 # Seconds to delay between message a bot makes to avoid accidental spam mcversion=1.14.4 # Use 'auto' or '1.X.X' values brandinfo=vanilla # Use 'mcc','vanilla', or 'none' chatbotlogfile= # Leave empty for no logfile privatemsgscmdname=msg # Used by RemoteControl bot showsystemmessages=true # System messages for server ops showxpbarmessages=true # Messages displayed above xp bar showchatlinks=false # Show links embedded in chat messages terrainandmovements=true # Uses more ram, cpu, bandwidth inventoryhandling=true # Toggle inventory handling (beta) entityhandling=true # Toggle entity handling (beta) sessioncache=disk # How to retain session tokens. Use 'none', 'memory' or 'disk' resolvesrvrecords=fast # Use 'false', 'fast' (5s timeout), or 'true'. Required for joining some servers. accountlist=accounts.txt # See README > 'Servers and Accounts file' for more info about this file serverlist=servers.txt # See README > 'Servers and Accounts file' for more info about this file playerheadicon=true # Only works on Windows XP-8 or Windows 10 with old console exitonfailure=false # Disable pauses on error, for using MCC in non-interactive scripts debugmessages=true # Please enable this before submitting bug reports. Thanks! scriptcache=true # Cache compiled scripts for faster load on low-end devices timestamps=false # Prepend timestamps to chat messages autorespawn=false # Toggle auto respawn if client player was dead (make sure your spawn point is safe)

[Proxy] enabled=false # Use 'false', 'true', or 'login' for login only type=HTTP # Supported types: HTTP, SOCKS4, SOCKS4a, SOCKS5 server=0.0.0.0:0000 # Proxy server must allow HTTPS for login, and non-443 ports for playing username= # Only required for password-protected proxies password= # Only required for password-protected proxies

[MCSettings] enabled=true # If disabled, settings below are not sent to the server locale=en_US # Use any language implemented in Minecraft renderdistance=medium # Use tiny, short, medium, far, or chunk amount [0 - 255] difficulty=normal # MC 1.7- difficulty. peaceful, easy, normal, difficult chatmode=enabled # Use 'enabled', 'commands', or 'disabled'. Allows to mute yourself... chatcolors=true # Allows disabling chat colors server-side main_hand=left # MC 1.9+ main hand. left or right skin_cape=true skin_hat=true skin_jacket=false skin_sleeve_left=false skin_sleeve_right=false skin_pants_left=false skin_pants_right=false Bot Settings

---removed disabled stuff---

[AutoFishing] Entity Handling NEED to be enabled first enabled=true

` img

ORelio commented 4 years ago

Your fishing rod should be located in slot 0 to slot 8 (the hotbar) https://minecraft.gamepedia.com/Inventory

Frog-Lover-Antony commented 4 years ago

Your fishing rod should be located in slot 0 to slot 8 (the hotbar)

hmmm but its already in the hotbar slot 1 So, you see that the fishing rod is in slot 36, which does not make sense according to inventory layout. This looks like if paperspigot uses a different method of inventory managment. Gonna try conneting to local game and see if it makes any difference.

Frog-Lover-Antony commented 4 years ago

Well, see yourself screen Maybe mapping slots 36-44 to 0-8 would work?

ReinforceZwei commented 4 years ago

Even though the player is not facing the sea, the message Threw a fishing rod should appear. image You should check if the fishing rod was indeed threw out in the game after using /useitem, by using a game client and watch the bot. Sometimes anti-cheat plugins might do additional check for preventing bot client.

Frog-Lover-Antony commented 4 years ago

You should check if the fishing rod was indeed threw out in the game after using /useitem

Check. The fishing rod does work, but I get no "Threw a fishing rod" message anyway

Frog-Lover-Antony commented 4 years ago

@ReinforceZwei can I compare your configs and see what might be wrong with mine?

ReinforceZwei commented 4 years ago

Here is my config

# Minecraft Console Client v1.15.2
# Startup Config File

[Main]

# General settings
# Leave blank to prompt user on startup
# Use "-" as password for offline mode

login=
password=
serverip=

# Advanced settings

language=en_GB
consoletitle=%username%@%serverip% - Minecraft Console Client
internalcmdchar=slash              # Use 'none', 'slash' or 'backslash'
splitmessagedelay=2                # Seconds between each part of a long message
botowners=Player1,Player2,Player3  # Use name list or myfile.txt with one name per line
botmessagedelay=2                  # Seconds to delay between message a bot makes to avoid accidental spam
mcversion=auto                     # Use 'auto' or '1.X.X' values
brandinfo=mcc                      # Use 'mcc','vanilla', or 'none'
chatbotlogfile=                    # Leave empty for no logfile
privatemsgscmdname=tell            # Used by RemoteControl bot
showsystemmessages=true            # System messages for server ops
showxpbarmessages=true             # Messages displayed above xp bar
showchatlinks=true                 # Show links embedded in chat messages
terrainandmovements=false          # Uses more ram, cpu, bandwidth
inventoryhandling=true            # Toggle inventory handling (beta)
entityhandling=true               # Toggle entity handling (beta)
sessioncache=disk                  # How to retain session tokens. Use 'none', 'memory' or 'disk'
resolvesrvrecords=fast             # Use 'false', 'fast' (5s timeout), or 'true'. Required for joining some servers.
accountlist=accounts.txt           # See README > 'Servers and Accounts file' for more info about this file
serverlist=servers.txt             # See README > 'Servers and Accounts file' for more info about this file
playerheadicon=true                # Only works on Windows XP-8 or Windows 10 with old console
exitonfailure=false                # Disable pauses on error, for using MCC in non-interactive scripts
debugmessages=false                # Please enable this before submitting bug reports. Thanks!
scriptcache=true                   # Cache compiled scripts for faster load on low-end devices
timestamps=false                   # Prepend timestamps to chat messages
autorespawn=false                  # Toggle auto respawn if client player was dead (make sure your spawn point is safe)

[AppVars]
# yourvar=yourvalue
# can be used in some other fields as %yourvar%
# %username% and %serverip% are reserved variables.

[Proxy]
enabled=false                      # Use 'false', 'true', or 'login' for login only
type=HTTP                          # Supported types: HTTP, SOCKS4, SOCKS4a, SOCKS5
server=0.0.0.0:0000                # Proxy server must allow HTTPS for login, and non-443 ports for playing
username=                          # Only required for password-protected proxies
password=                          # Only required for password-protected proxies

[ChatFormat]
# Do not forget to uncomment (remove '#') these settings if modifying them
builtins=true                      # MCC built-in support for common message formats
# public=^<([a-zA-Z0-9_]+)> (.+)$
# private=^([a-zA-Z0-9_]+) whispers to you: (.+)$
# tprequest=^([a-zA-Z0-9_]+) has requested (?:to|that you) teleport to (?:you|them)\.$

[MCSettings]
enabled=true                       # If disabled, settings below are not sent to the server
locale=en_US                       # Use any language implemented in Minecraft
renderdistance=medium              # Use tiny, short, medium, far, or chunk amount [0 - 255]
difficulty=normal                  # MC 1.7- difficulty. peaceful, easy, normal, difficult
chatmode=enabled                   # Use 'enabled', 'commands', or 'disabled'. Allows to mute yourself...
chatcolors=true                    # Allows disabling chat colors server-side
main_hand=left                     # MC 1.9+ main hand. left or right
skin_cape=true
skin_hat=true
skin_jacket=false
skin_sleeve_left=false
skin_sleeve_right=false
skin_pants_left=false
skin_pants_right=false
# Bot Settings

[Alerts]
enabled=false
alertsfile=alerts.txt
excludesfile=alerts-exclude.txt
beeponalert=true

[AntiAFK]
enabled=false
delay=600 #10 = 1s
command=/ping

[AutoRelog]
enabled=false
delay=10
retries=3 #-1 = unlimited
ignorekickmessage=false
kickmessagesfile=kickmessages.txt

[ChatLog]
enabled=false
timestamps=true
filter=messages
logfile=chatlog-%username%-%serverip%.txt

[Hangman]
enabled=false
english=true
wordsfile=hangman-en.txt
fichiermots=hangman-fr.txt

[ScriptScheduler]
enabled=false
tasksfile=tasks.ini

[RemoteControl]
enabled=false
autotpaccept=true
tpaccepteveryone=false

[AutoRespond]
enabled=false
matchesfile=matches.ini

[AutoAttack]
# Entity Handling NEED to be enabled first
enabled=true

[AutoFishing]
# Entity Handling NEED to be enabled first
enabled=true
[AutoEat]
# Inventory Handling NEED to be enabled first
enabled=true
threshold=6
Frog-Lover-Antony commented 4 years ago

Got no idea why, but it works with your config

screen

inaccurate results bc bot is fishing on the ground

Config difference: diff1 diff2

Going to play around the configuration, see what causes the script not to work and close the issue

Frog-Lover-Antony commented 4 years ago

Easily enough, I found out that fishing does not work if terrainmovements is set to true. So when you need both of them, consider using /move on and /move off to prevent such thing happening. Thanks to @ReinforceZwei for help Thanks @ORelio for such a big job working on the app and help. I'm going to do my best contributing to the project :smiley:

ReinforceZwei commented 4 years ago

I think it should be a bug :thinking: AutoFishing should be work with terrainmovements=true Would you mind reopen the issue and change the issue title to this bug? Or submit a new issue?