Skip to content
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

Problems with Es_delayeds execution of commands #41

Open
ManifestManah opened this issue Aug 1, 2020 · 2 comments · May be fixed by #52
Open

Problems with Es_delayeds execution of commands #41

ManifestManah opened this issue Aug 1, 2020 · 2 comments · May be fixed by #52

Comments

@ManifestManah
Copy link
Contributor

I have gotten a few reports of cases from WCS users where certain parts of the skills would not work.
These skills were working for me when I tested them. Today I updated my Emulator to the most recent version and I am now experiencing the same issue as the other users.

It turns out, that using es_delayed followed by a command will cause that command to not be executed.
But if you do es_delayed followed by es and then followed by the command, then the command will be executed.
Although this doesn't seem to apply to certain built-in eventscripts commands, this seems to break a lot of custom commands outside of eventscripts.

This is of course not ideal, but it apparently has been like this for a long time. But it hasn't been as noticeable because in the past it has been this way but only when executing the commands through the server console.
But with the change you made the 10th of April this year, it changed it around so the problem wasn't occurring in the server console anymore, however, it instead started occurring in every script. Meaning that all scripts using es_delayed would need to be changed to es_delayed es instead in order for them to be executed.

The change I'm referring to is one:
3f326be

I have changed my own server's addons/source-python/plugins/es_emulator/eventscripts/esc/cmds/run.py back to what it was prior to the update as seen below:

import gamethread, esc
from gamethread import queue, delayed
from .. import stack
from ..val import sv, FLOAT, VAR
from . import Command
import es

@Command(syntax='<variable>', types=VAR, desc='Just runs a command-string inside of the variable.')
def commandv(argv):
  stack.insertrawline(sv(argv[0]))
  
@Command(argsfrom=2, syntax='<seconds> <commandstring>', types=FLOAT, desc='Will run <commandstring>, after <seconds> seconds.')
def delayed(argv, args):
  gamethread.delayed(argv[0], stack.queueline, (argv[1], argv[2:], args, esc.stack.currentblock, True))

@Command(syntax='<commandstring>', desc='Adds a command to the end of the command queue.')
def soon(argv, args):
  queue(stack.queueline, (argv[0], argv[1:], args, esc.stack.currentblock, True))

@Command(syntax='<file>', desc='Runs an exec file from memory.')
def old_mexec(argv):
  es.old_mexec(*argv)

This does mean that I cannot use es_delayed without adding an additional es to the console when I wish to do some testing that involves delays, but the alternative is that a lot of scripts will break, which will affect every player on the servers.
So, in my opinion, this is definitely the lesser of two evils, and I would recommend changing it back to this as well, at last until a full fix is found, as it is far less damaging.

I am running the newest version of Source-Python, and the Emulator and Warcraft-Source.

--------------------------------------------------------
Checksum      : 3a539eb78239fc93f8f6f382d3c397df
Date          : 2020-08-01 12:18:11.622719
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
   01: es_emulator_events
   02: wcs, 2020.07.31-4, https://forums.sourcepython.com/viewtopic.php?f=7&t=1925
   03: commandsx
--------------------------------------------------------

@Ayuto
Copy link
Owner

Ayuto commented Aug 16, 2020

I'm unable to reproduce the issue with the following test code:

block load
{
    es_setinfo x 444
    es_delayed 1 es_msg without es command: 123 server_var(x)
    es_delayed 1 es es_msg with es command: 123 server_var(x)
}

Output:

es_load estest1
[EventScripts] Loaded estest1
without es command : 123 444
with es command : 123 444

Manually entering it in the server console:

es_delayed 1 es_msg without es command: 123 server_var(x)
without es command : 123 444
es_delayed 1 es es_msg with es command: 123 server_var(x)
with es command : 123 444

Please try to give a minimalistic example that reproduces the issue.

@ManifestManah
Copy link
Contributor Author

Yes, naturally you wont have any issues or bugs testing our these commands as they are already built-in EventScripts commands.
The issue that I reported is about custom commands t hat are not already built-in to the EventScripts Emulator, but the commands are Source-Python commands and does work with the emulator as long as you just don't use es_delayed in front of them without adding an es right after the specified amount of delay.
A minimalistic example could be:

event player_spawn
{
	es_delayed 1 wcs_setfx speed event_var(userid) = 2.5 0
}

Under normal circumstances prior to the implemented change, or when using the change above, then this will cause the player to run at a 250% speed.
But after the implemented change and with the current code the emulator is using it will not execute anything behind the es_delayed 1 in the example code. It'll only execute it if we add an "es" after the delayed value and before the next command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants