Ayuto / EventScripts-Emulator

A Source.Python plugin that is able to run EventScripts addons.
16 stars 9 forks source link

Popup Menu doesn't seem to be working #38

Closed ManifestManah closed 3 years ago

ManifestManah commented 4 years ago

While working on my own mod that relies on the Eventscript Emulator I ran in to an issue with the popup system. I already have es_load popup added to my autoexec.cfg and I have tried to create the popup menus in a few different ways. One of the ways I tried was using the example for creating popups that can be found on ES:S website. (Example code posted below)

block load
{
    popup create TestMenu
    popup addline TestMenu "Choose your drink:"
    popup addline TestMenu "->1. Water"
    popup addline TestMenu "->2. Juice"
    popup addline TestMenu "->3. Milk"
    popup addline TestMenu "->4. Coffee"
    popup addline TestMenu "0. Close"

    popup menuselect TestMenu popupt/chosen
}

event player_say
{
    if (event_var(text) == "!drink") do
    {
        es popup send TestMenu event_var(userid)
    }
}

block chosen
{
    if (server_var(_popup_choice) == 1) then es_tell server_var(_popup_userid) You chose Water!
    if (server_var(_popup_choice) == 2) then es_tell server_var(_popup_userid) You drink Juice!
    if (server_var(_popup_choice) == 3) then es_tell server_var(_popup_userid) Milk is good for you!
    if (server_var(_popup_choice) == 4) then es_tell server_var(_popup_userid) Coffee might ruin your sleep!
    if (server_var(_popup_choice) > 4) do
    {
        if (server_var(_popup_choice) < 10) do
        {
            es_tell server_var(_popup_userid) You should have chosen an option between 1 and 4...
        }
    }
}

block unload
{
    popup unsendname TestMenu #all
    popup delete TestMenu
}

When I attempted to test this code I did locate it in the directory eventscripts/popupt, having a file named es_popupt.txt and I loaded the file prior to the testing. The popup menu would not appear, and I received no errors in my server's log file, nor anything in the source.python log directory.

Ayuto commented 4 years ago

Actually, it works fine if you first load popup and then load your test plugin popupt.

It does not seem to work if you first load popupt, then load popup and then reload popupt.

ManifestManah commented 4 years ago

I had already attempted what you suggest above, but it did not work for me at the time. I figured maybe it was related to external plugins or addons that I was running on my server which were causing some issues causing the popup menus to break.

I just did a complete reinstall of my server (Linux) and I figured, that while I am setting up the server I will try and test this out and see if I can make it work. The script used for testing this is the exact same one that was previously posted just above.

This is how my autoexec.cfg looks right now.

//Loads the EventScripts Emulator by Ayuto
sp plugin load es_emulator

//Loads the Popup Module from the Emulator 
es_load popup

//Loads the Popupt test script (Needs to be loaded after the Popup since it uses the Popup menu features)
es_load popupt

The server was completely reinstalled and is as clean as they come. The only things that I have installed on the server is the most recent versions of: MetaMod, Source-Python, The Eventscripts Emulator and this one Popupt script.

IMPORTANT: Please copy the full output.
--------------------------------------------------------
Checksum      : e9233841f778fa16839b5905607d6d67
Date          : 2020-08-04 12:57:37.695661
OS            : Linux-4.15.0-88-generic-x86_64-with-debian-stretch-sid
Game          : csgo
SP version    : 699
Github commit : 7e06ce8e445e17425dfcecdad5895473c294fabc
Server plugins:
   00: Source.Python, (C) 2012-2020, Source.Python Team.
   01: Metamod:Source 1.10.7-dev
SP plugins:
   00: es_emulator, https://github.com/Ayuto/EventScripts-Emulator
--------------------------------------------------------
Ayuto commented 4 years ago

Have you tried it without Metamod/SM?

ManifestManah commented 4 years ago

At the time of this test my server was running nothing else but MetaMod and Source-Python. SourceMod had yet to be installed. It did however have MetaMod installed. But it seems less than ideal if the Eventscript Emulator's popup feature cannot work the moment you install MetaMod. Whether this is the case, is uncertain for me as of right now. I will have to test it out to determine whether that'd be the case.

ManifestManah commented 4 years ago

I just went on and disabled my SourceMod, MetaMod, unloaded WCS and then loaded the script even after having es_popup set to be loaded in my autoexec.cfg and the result remains unchanged. The popup is still not being displayed to me.

image