Page 1 of 1
[TF2] VGUIMenu not working
Posted: Sun Dec 21, 2014 9:52 pm
by Rob123
Trying to get VGUIMenu's working for TF2, but not much luck. To get support for all message types in the first place, I simply made a duplicate of data/source-python/messages/games/cstrike.ini as tf.ini in the same folder. This seemingly works for all message types, except VGUIMenu. There are no errors, and no menu is made visible to the client, so I'm a bit stuck.
Sample of trying to call the menu:
Code: Select all
from commands.client import ClientCommand
from players.helpers import index_from_playerinfo
from messages import VGUIMenu
@ClientCommand('!msg')
def test(playerinfo, command):
msg = VGUIMenu(name='motd', show=1, subkeys={'title': "Test", 'type': 2, 'msg': 'http://www.google.com'})
msg.send(index_from_playerinfo(playerinfo))
Not sure if there's some modification needed to the tf.ini file, or the way i'm trying to call the menu, but the functionality definitely exists for this type of menu in TF2, as it is possible with ES and SM.
Thanks for any help
Posted: Sun Dec 21, 2014 10:43 pm
by L'In20Cible
The name of the panel is
info not
motd. However, it would requires a custom class for TF2 (just like CSS). Could you test the following and let me know if that works for you?
Syntax: Select all
from commands.client import ClientCommand
from _messages import UserMessage
from filters.recipients import RecipientFilter
from players.helpers import index_from_playerinfo
def motd(users, name, show=1, subkeys=dict()):
recipients = RecipientFilter(users)
message = UserMessage(recipients, 'VGUIMenu')
message.set_string('name', name)
message.set_byte('show', show)
message.set_byte('length', len(subkeys))
for key, value in subkeys.items():
message.set_string('key', key)
message.set_string('value', value)
message.send_message()
@ClientCommand('!msg')
def test(playerinfo, command):
motd(index_from_playerinfo(playerinfo),
name='info', show=1,
subkeys={'title': 'Test', 'type': '2', 'msg': 'http://www.google.com'})
While the syntax should stay the same for the current message classes, the complete implementation is going to change internally due to large amount of issues/differences between bitbuf and protobuf based messages across engines. I have a lot of work/testing done but I'm delaying and delaying again as every time I get into it, I'm getting headaches and get bored.

I will try my best to at least push a testing branch soon.
Posted: Mon Dec 22, 2014 4:07 am
by Rob123
Yep that worked, thanks!
Posted: Tue Jun 09, 2015 10:36 am
by Mahi
Bump! Apparently this code no longer works, I get the MOTD popup but the website doesn't show. Any fix? Using CS:S.
Posted: Tue Jun 09, 2015 3:47 pm
by satoon101
I was able to do a bit of testing on this today. I decided to start an issue for it with my findings:
https://github.com/Source-Python-Dev-Team/Source.Python/issues/65
Posted: Tue Jun 09, 2015 6:09 pm
by L'In20Cible
Mahi wrote:Bump! Apparently this code no longer works, I get the MOTD popup but the website doesn't show. Any fix? Using CS:S.
Which code? Also, make sure to type the following in your client console.
Posted: Tue Jun 09, 2015 6:59 pm
by satoon101
I have the issue with both your code above and the code I posted in the issue. My cl_disablehtmlmotd is already set to 0. Half of the time, an MOTD will pop up but go away immediately. The other half, an MOTD will come up with just the word 'type' at the top of a blank page.
I tested with ES, and it still works "mostly" fine. Occasionally, it will have the issue where the MOTD pops up and disappears immediately. This behavior seems to be more scarce, though.
Posted: Tue Jun 09, 2015 9:06 pm
by satoon101
Sorry, I mis-spoke earlier. The code above works just as ES', where it "mostly" works except on occasion when it disappears immediately. This always happens the very first time I send a MOTD, and then only very occasionally afterward. I just finish testing the code above on CS:S, DOD:S, HL2:DM, and TF2. It works as described for each of those 4 games. It currently crashes BMS, though I have not done any debugging to find out what in the code is causing that crash.