SpunkyBot / spunkybot

Multi-platform administration and RCON tool for Urban Terror
https://spunkybot.de
MIT License
20 stars 24 forks source link

!nextmap and !mapcycle returns "blank" response #110

Closed UG-Asger closed 3 years ago

UG-Asger commented 3 years ago

Summary !nextmap and !mapcycle returns "blank" response

Steps to reproduce

  1. Send message !nextmap
  2. Send message !mapcycle

Expected behavior

  1. Spunky returns next map in the mapcycle.txt
  2. Spunky returns the current mapcycle on the server

Runtime Environment

devel.log

image image

github-actions[bot] commented 3 years ago

Hi, thanks for your contribution! Great first issue!

alexanderkress commented 3 years ago

Please add the file "devel.log" from your spunkybot root folder. With this high number of maps the commands will not work, the q3a engine cannot handle that. Let's see if the bot was able to count the maps... Do you have a server with less maps, e.g. less than 40 maps? If yes, please test the commands, and you should see that they are working :-)

alexanderkress commented 3 years ago

Arfff sorry, the devel.log is upload but was very good hidden... No need to upload something again.

alexanderkress commented 3 years ago

Did you install from scratch? Or did you do updates over time? So e.g. are also the files under the folder "lib" up-to-date? Or did you maybe install the bot version 1.10.x and upgraded later on only the file spunky.py? According to the devel.log file, the bot cannot communicate properly with the Quake3 CLI. Is this the official server binary or some custom build?

UG-Asger commented 3 years ago

Hello. Installed 1.12.2 from scratch (Used B3 before and here !nextmap worked fine) and it's the original 4.3.4 server binary

alexanderkress commented 3 years ago

okay. but you have a massive problem on your end, it is not related on !nextmap command. according to the logfile, there is no communication at all via the console possible. Go to spunkybot/lib/ folder and open the file "pyquake3.py" with a text editor or IDLE. on the bottom you will find a section starting with "if name == 'main':". Modify the line "QUAKE = PyQuake3(server='localhost:27960', rcon_password='secret')" with your UrT server details, afterwards save and execute this file. If you are using IDLE, just run it, otherwhise "python.exe pyquake3.py". You should also be ingame, so that the script can find an online player and in addition a message ingame shall be shown when running the script.

UG-Asger commented 3 years ago

Yep, got a message in the middle of the screen: "pyquake3 is great"

C:\Spunky\1\lib>python pyquake3.py The server name of 'localhost:27961' is |UG|FFA|, running map ut4_paris with 1 player(s). |UG|Asger with 0 frags and a 0 ms ping |UG|Asger^7 (0) has IP address of 192.168.0.1:27960

C:\Spunky\1\lib>

But other commands work fine, so the bot is communicating with the server

UG-Asger commented 3 years ago

Just tried with the M9 server binary devel.log

Seems !nextmap is working and i don't see the errors in the log (only with standard maps, though)

!mapcycle still not working on the M9 server binary

UG-Asger commented 3 years ago

Okay. Now i copied all the 3rd party maps to the M9 server and i see the same issues. So the amount of maps or maybe some specific ones ruins it all. I will remove all not needed. I guess that will solve most of the problems except for the !mapcycle command. Are you aware of the max amount of maps Urban Terror can handle?

alexanderkress commented 3 years ago

yeah the devel.log of your M9 server is looking perfect, as it should be. Only the mapcycle is not working. Which file are you using, mapcycle.txt? where is it located and how does it look like? if possible you should test the original binary with the 35 standard maps.

well, the bot has several ways to communicate to your server, therefore most commands are working fine. the bot reads the games.log file, responds via RCON, this is all working fine. but to get the current ping or even some server CVARs, the bot is using the console and requests output like "rcon status", or asks for CVARs like "g_logsync" etc. and only this part is not working in your case, when you have the custom maps on your server.

35 maps is the max UrT can handle :-D I have no idea... maybe the rcon_delay needs to be extended from 0.3 sec to something bigger when there are several extra maps.

UG-Asger commented 3 years ago

Well. Spunky is located on C drive and game servers on D drive. I'm using the same Urban Terror files for all servers and specified different cfg folders containing server.cfg, mapcycle.txt and games.log image

UG-Asger commented 3 years ago

Mapcycle is without any cvars only map names image

alexanderkress commented 3 years ago

I have tested m9 mod build 143 on linux (Windows 10 via WSL ubuntu) successfully with my dev version of spunkybot:

[24.04.2021 14:39:42] DEBUG    fs_homepath           : /home/alex/.q3a
[24.04.2021 14:39:43] DEBUG    fs_basepath           : /mnt/c/UrbanTerror43
[24.04.2021 14:39:43] INFO     Mapcycle path         : /home/alex/.q3a/q3ut4/mapcycle.txt
[24.04.2021 14:39:44] DEBUG    Current map: ut4_turnpike / Next map: ut4_casa
[24.04.2021 14:39:44] INFO     Mapcycle: ut4_austria, ut4_turnpike, ut4_casa, ut4_abbey, ut4_algiers, ut4_swim
[24.04.2021 14:39:44] INFO     *** Live tracking: Current map: ut4_turnpike / Next map: ut4_casa ***
[24.04.2021 14:39:44] INFO     Total number of maps  : 35

we should check your server config or the run script, because this debug output on your system is strange:

[24.04.2021 13:31:05] DEBUG    fs_homepath           : D
[24.04.2021 13:31:06] DEBUG    fs_basepath           : D

at least one of them should include D:\GameServer\UrT\1\ otherwise the bot will not be able to locate your mapcycle.txt file.

UG-Asger commented 3 years ago

D:\GameServer\UrT43\Quake3-UrT-Ded.exe +set com_hunkmegs 128 +set fs_homepath D:\GameServer\UrT43\1 +set fs_game q3ut4 +set net_port 27961 +exec server.cfg

alexanderkress commented 3 years ago

OMG noob :-D

use this as well: +set use_defaultHomePath 0

UG-Asger commented 3 years ago

Ohh f*ck, I'm missing q3ut4

alexanderkress commented 3 years ago

for the homepath variable you do NOT add the subfolder q3ut4, but it must exist under folder "1"

alexanderkress commented 3 years ago

and I hope under the subfolder "q3ut4" you have the config and mapcycle.txt stored...

UG-Asger commented 3 years ago

image

alexanderkress commented 3 years ago

I was running now for the first time UrT server on Windows....

[24.04.2021 14:56:42] DEBUG    fs_homepath           : C
[24.04.2021 14:56:43] DEBUG    fs_basepath           : C
[24.04.2021 14:56:44] DEBUG    Current map: ut4_turnpike / Next map: ut4_turnpike
[24.04.2021 14:56:44] INFO     Mapcycle:

In this case the mapcycle is also not working. homepath and basepath values have wrong content. and I guess I know why... when searching for the file, I am searching and splitting for ":", which exists only on Windows systems

UG-Asger commented 3 years ago

Haha, maybe i'm the only noob on Windows :) Can you fix it so it works for Windows too?

alexanderkress commented 3 years ago

this should work... can you open spunky.py and somewhere at line 4020 or below you should see "def get_cvar(..." search for the line "ret_val = self.quake.rcon(value)[1].split(':')[1].split('^7')[0].lstrip('"')" and change it to "ret_val = self.quake.rcon(value)[1].split(':', 1)[1].split('^7')[0].lstrip('"')"

alexanderkress commented 3 years ago

this will split only onetime on ":"... and yes less than 10% of all server admins using spunkybot are windows users

UG-Asger commented 3 years ago

:)

[24.04.2021 15:07:27] INFO Spunky Bot v1.12.2 : www.spunkybot.de [24.04.2021 15:07:27] INFO Starting logging : OK [24.04.2021 15:07:27] INFO Loading config file : C:\Spunky\1\conf\settings.conf [24.04.2021 15:07:27] INFO Configuration loaded : OK [24.04.2021 15:07:27] INFO Connecting to Database: OK [24.04.2021 15:07:27] DEBUG Cmd !iamgod available : False [24.04.2021 15:07:27] INFO Parsing Gamelog file : D:\GameServer\UrT43M9\1\q3ut4\games.log [24.04.2021 15:07:27] INFO Game modversion : 4.3 [24.04.2021 15:07:27] INFO Opening RCON socket : OK [24.04.2021 15:07:27] INFO Activating the Bot : OK [24.04.2021 15:07:27] INFO Startup completed : Let's get ready to rumble! [24.04.2021 15:07:27] INFO Spunky Bot is running until you are closing this session or pressing CTRL + C to abort this process. [24.04.2021 15:07:27] INFO Note: Use the provided initscript to run Spunky Bot as daemon [24.04.2021 15:07:28] DEBUG fs_homepath : D:\GameServer\UrT43M9\1 [24.04.2021 15:07:28] DEBUG fs_basepath : D:\GameServer\UrT43M9 [24.04.2021 15:07:29] INFO Mapcycle path : D:\GameServer\UrT43M9\1\q3ut4\mapcycle.txt [24.04.2021 15:07:29] DEBUG Current map: ut4_paris / Next map: ut4_uptown [24.04.2021 15:07:29] INFO Mapcycle: ut4_paris, ut4_uptown, ut4_algiers, ut4_docks, ut4_suburbs, ut4_turnpike, ut4_swim, ut4_ramelle, ut4_ricochet, ut4_riyadh, ut4_casa, ut4_prague, ut4_abbey [24.04.2021 15:07:29] INFO Live tracking: Current map: ut4_paris / Next map: ut4_uptown [24.04.2021 15:07:29] INFO Total number of maps : 34 [24.04.2021 15:07:29] INFO Server CVAR g_logsync : 1 [24.04.2021 15:07:30] INFO Server CVAR g_loghits : 1

alexanderkress commented 3 years ago

awesome... who is the best? :-) which bot is the best bot in da world? :-D

UG-Asger commented 3 years ago

Yep, you are the man! Cool and thanks mate :)

alexanderkress commented 3 years ago

okay cool. I cannot tell you, if this change has some other impact, so I need to check first where else it is used. but a fix for this issue should be possible.

UG-Asger commented 3 years ago

Regarding Prism, i can test also if you make the files available

alexanderkress commented 3 years ago

yeah there was some guy blocking me with some windows related issues...

UG-Asger commented 3 years ago

What an idiot :) lol

alexanderkress commented 3 years ago

on my dev version of PRISM I changed a lot in the past but never committed that... currently I have some php notice messages, which I ignore now. but the rest looks fine... will be close to 0.9.9 release :-D

UG-Asger commented 3 years ago

Thanks a lot for taking time to support this. It's really appreciated 👍

alexanderkress commented 3 years ago

you are welcome...

UG-Asger commented 3 years ago

Hello. Is it possible to change a value somewhere to log stats for non registered players? I run public servers and most people don't register. It would be nice to see all stats :) Should i add it as a feature request with a value set to 1 or 0 in the config file?

alexanderkress commented 3 years ago

but this is the basic idea, people who do not register, do not get their stats... why do you want the stats from others, if they even are not interested in? on the other hand, you can put any user in the "user" group with the command !putgroup @1233 user

so your idea would be autoregister anyone and store all stats, correct?

UG-Asger commented 3 years ago

Not exactly, i want to log stats for all players, registered or not. Maybe as an option in the config. I don't want to auto register players.

UG-Asger commented 3 years ago

And maybe add Guests tab in Prism: image

Just my thoughts ;) It's up to you :)

alexanderkress commented 3 years ago

No, that is not possible. This would require a lot of redesign... it is open source, feel free and contribute :-)

UG-Asger commented 3 years ago

Cool. I will use it as it is :) and thank's again for your support :)

UG-Asger commented 3 years ago

For your information the bot goes sideways when you exeed 52 maps and UrT contains 35 maps standard ;( Leaves only 17 3rd party maps available ;(

alexanderkress commented 3 years ago

I have 102 maps on my test system and everything is working fine. !nextmap command is always showing the correct map.

BUT: you are right, when reaching 52 maps, the UrT CVAR fs_homepath is not working anymore and it is using then fs_basepath to search for the mapcycle.txt file. I guess on Windows it is then searching for the folder, where UrT is installed and there is only a mapcycle_example.txt file. Linux is behaving here different.

alexanderkress commented 3 years ago

ok I have added a nasty workaround which should work, or at least work a bit better, when having more than 52 maps on the server

UG-Asger commented 3 years ago

Sounds cool. Where can i find the code or what do i need to change?

alexanderkress commented 3 years ago

This code will go into the premium version. The free version will support 52 maps and the premium version more :-D The code is not released yet.

UG-Asger commented 3 years ago

😛

UG-Asger commented 3 years ago

We have a joint WAN/LAN event the 14th and 15th of May. Would it be possible to release it before that? 🤞

alexanderkress commented 3 years ago

Puh... I guess you have to post-pone that to 16th of May :-D

UG-Asger commented 3 years ago

;(

UG-Asger commented 3 years ago

Hi Alexander

Does this mean that if i make these changes in my spunky.py the problem is fixed or do i need to wait for 1.13 release?

alexanderkress commented 3 years ago

if you are brave, you could take the dev version or simply add these 3 lines at code line 3950 and following to your version. You had already changed line 3932 on your system.