[TF2] VGUIMenu not working

Please post any questions about developing your plugin here. Please use the search function before posting!
Rob123
Junior Member
Posts: 7
Joined: Sat Sep 20, 2014 1:11 am

[TF2] VGUIMenu not working

Postby Rob123 » Sun Dec 21, 2014 9:52 pm

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
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sun Dec 21, 2014 10:43 pm

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. :rolleyes: I will try my best to at least push a testing branch soon.
Rob123
Junior Member
Posts: 7
Joined: Sat Sep 20, 2014 1:11 am

Postby Rob123 » Mon Dec 22, 2014 4:07 am

Yep that worked, thanks!
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Tue Jun 09, 2015 10:36 am

Bump! Apparently this code no longer works, I get the MOTD popup but the website doesn't show. Any fix? Using CS:S.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Jun 09, 2015 3:47 pm

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
Image
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Tue Jun 09, 2015 6:09 pm

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.

Code: Select all

cl_disablehtmlmotd 0
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Jun 09, 2015 6:59 pm

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.
Image
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Jun 09, 2015 9:06 pm

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.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 23 guests