-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match details #67
Comments
|
So for get this match_details, user witch one play via python code, should be in lobby all time till game will finished? |
I don't understand what you are asking |
I'm asking about, to get information about which team won, you need the bot to be in the match until the end of the game, right? |
No. Just get the match details after the match |
How script can know when match is finished? |
Assuming you're waiting for the match to finish and not retrieving details of a public lobby - On the lobby event:
You can create a dispatcher that handles all the lobby states from the |
Can you give me some example how to do it for get match results? |
Sure friend Initialize the I wrote this in a hurry so hope you can understand from dota2.common_enums import ESOType
from dota2.features import sharedobjects as so
# get lobby proto
CSODOTALobbyProto = so.find_so_proto(ESOType.CSODOTALobby)
LobbyState = CSODOTALobbyProto.State
# add this callback for event 'lobby_changed'
dota_client.on('lobby_changed', lobby_change_handler)
# lobby state handler dispatch
state_handler_dispatch = dict([
(LobbyState.UI, #callable here),
(LobbyState.READYUP, #callable here),
(LobbyState.NOTREADY, #callable here),
(LobbyState.SERVERSETUP, #callable here),
(LobbyState.RUN, #callable here),
(LobbyState.POSTGAME, post_game_handler),
(LobbyState.SERVERASSIGN, #callable)
])
def lobby_change_handler(message):
logger.info(f"Event: Lobby Change: {message}")
# if message field has state
if message.HasField('state'):
# call appropriate handler for lobby state
state_handler_dispatch[message.state](message)
def post_game_handler(message):
# protobuf message passed to this callable will contain info about the postgame
pass |
I made a slight error which I corrected. Attach the post game handler to |
Can you show me the code for this?
You're getting a KeyError, which means you're attempting to get a key
in `state_handler_dispatch`
that doesn't exist.
…On Mon, Jul 12, 2021 at 2:11 AM Mrfull ***@***.***> wrote:
@DEV-ONI <https://github.com/DEV-ONI> If you know can you answer on thats
questions:
#68 <#68>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMOT7ZAHRKNGCEKL7QDM63LTXHNFBANCNFSM47J6BBWA>
.
|
@DEV-ONI
|
I want to get results(who win or lose) in match, how i can do it?
It's return to me some job_id, but what is it?
self.dota.request_match_details(match_id)
And where i can get match_id if i create lobby by
settings = { 'game_name': lobby_name, "game_mode": DOTA_GameMode.DOTA_GAMEMODE_1V1MID, "pass_key": "PWA", } self.dota.create_practice_lobby(password, settings)
The text was updated successfully, but these errors were encountered: