Blizzard / s2client-proto

StarCraft II Client - protocol definitions used to communicate with StarCraft II.
MIT License
3.79k stars 433 forks source link

Capturing chat message by triggers #89

Open samvelyan opened 6 years ago

samvelyan commented 6 years ago

Hi there,

I'm having troubles with triggering a chat message Event using the protocol. Here's what I do.

I work with a custom map I created. During the game I perform an Action as ActionChat(message = 'test')). The result of the action is successful and I am able to see the message on the screen. Using the Map Editor, I created a trigger with the following Event:

Game -Player Any Player types a chat message containing "test", matching Exactly

However, the event is never triggered. Is this a bug?

My high-level goal is to trigger ANY event using the protocol. I just want to be able to work with custom map triggers using the protocol. If there are easier ways to do this w/o messages, I'd be happy to use those.

Many thanks

lschmelzeisen commented 6 years ago

We can reproduce this problem and are also seeking for a way to communicate bidirectionally from python to the game and back. Has there been any progress?

mharradon commented 5 years ago

We're not seeing any chat from the receive end still, also trying to implement bidirectional communication. Has anyone made progress on this or found another approach?

Currently my only idea is to communicate by bit-packing messages into the curriculum score. It appears that debug commands and triggers can read/write to it... lol.

TheSumm commented 5 years ago

I did not have any success with catching any kind of chat message using the custom map triggers/events.

To communicate with the custom map I ended up encoding strings (my commands) through camera movements in an initial setup phase. Moving the camera was one of the simplest actions to perform and detecting a change in camera position using custom map triggers is also straightforward.

I did not find a proper way to communicate in the other direction, but the "banks" feature that custom maps offer was sufficient for my use case. Banks are xml files which can be written by custom maps. Afterwards, I could parse these banks and process the gathered data.

lschmelzeisen commented 5 years ago

Same here, we ended up using camera movements to communicate from script to map (which was a pain to implement). For the other way, our requirements were very simple, and we just used the minerals/vespene resource counts. Your approach of using the curriculum score sounds a bit more elegant but still far from perfect.

mharradon commented 5 years ago

Thanks for the responses! One oddity I noticed recently is that (on MacOS) if you click in the spawned window when running PySC2 (the game rendering without UI overlay) and send a chat message as if playing the game (press enter + type msg + press enter) the chat message does in fact show up in the observations (though not on screen). So I have some faint hope that there's an esoteric combination of chat "types" that may still work - will update if we figure anything out.

Thank you very much for the resource and camera movement suggestions - we may end up proceeding with those approaches.

AustinHudelson commented 5 years ago

This was implemented in the Windows 4.9.3 version of the game.

https://starcraft2.com/en-us/news/23049576

Not available in a Linux package yet.

XinyiYS commented 4 years ago

Wondering if there is any update on this?