14:17 < richrd> anyone got any material on how the client-server protocol works?I 14:18 < richrd> I'm looking at creating a script that connects as spectator, and runs rcon commands and reads their output. 14:18 < richrd> I 14:18 < bridge> [teeworlds] I think @ChillerDragon wrote bots like that 14:19 < richrd> Trying to run rcon commands programmatically 14:19 < bridge> [teeworlds] You know about econ? 14:19 < richrd> I don't feel like copying the entire client code to do that 14:19 < richrd> No never heard 14:19 < bridge> [teeworlds] https://www.teeworlds.com/forum/viewtopic.php?id=8275 14:19 < bridge> [teeworlds] external console 14:20 < bridge> [teeworlds] (this way you don't even need to take a spectator slot) 14:20 < richrd> DOPE! 14:20 < bridge> [teeworlds] I think @jxsl13 also made some Teeworlds econ bots 14:20 < richrd> Can I run any command I want with it? 14:20 < bridge> [teeworlds] Any rcon command, yes 14:20 < bridge> [teeworlds] It's basically an alternative way to log in 14:21 < richrd> ahoy, cheers for that! solves my problems basically 14:21 < bridge> [teeworlds] =) glad to hear 14:23 < richrd> we have a tradition at work, where at 13:00 we have a "coffee break" which means we play TW for 30 minutes against each other 14:24 < richrd> yesterday we leveled up our game by having voice chat in discord for both red and blue teams. now we want to auto assign players and get some stats from the game 14:27 < bridge> [teeworlds] Sounds good 14:27 < bridge> [teeworlds] for stats also using econ you can also slap that on any vanilla server https://github.com/chillavanilla/TeeworldsEconMod 14:28 < bridge> [teeworlds] check it out on 149.202.127.134:8704 and type in /cmdlist in chat 14:31 < richrd> starred, will check out 👍 cheers! 14:32 < bridge> [teeworlds] do u also use github stars as "watch later" ? 😄 14:33 < richrd> yes, but usually only if I already know it will be of value to me :) 14:33 < bridge> [teeworlds] i really wish github would add some actual watch later feature separate from stars 14:33 < richrd> yeah that would help 14:39 < richrd> btw I'm wavi on TW 14:39 < richrd> can I send commands with telnet? 14:39 < richrd> to econ? 14:45 < bridge> [teeworlds] yes 14:46 < bridge> [teeworlds] you can use netcat or telnet to literally auth as admin and have a full functional admin console 14:46 < bridge> [teeworlds] similar to the one ingame 14:47 < richrd> I connected via telnet on unix, I can see all the logs coming in but sending stuff does nothing 🤔 14:48 < richrd> if I use TeeworldsEconMod do I need to run it on the same server where my tw server is? 14:50 < bridge> [teeworlds] yes it connects to localhost 14:51 < richrd> gotcha 14:51 < bridge> [teeworlds] https://github.com/chillavanilla/TeeworldsEconMod/blob/master/bin/nc.exp#L12 14:51 < bridge> [teeworlds] can be edited here tho 14:54 < richrd> does it need access to the logfiles though? 14:55 < bridge> [teeworlds] https://github.com/jxsl13/TeeworldsEconDiscordModerationBot 14:56 < bridge> [teeworlds] nah no logfiles needed 14:56 < bridge> [teeworlds] it reads from stdout of the server 14:57 < bridge> [teeworlds] the logfiles are used for some optional logging on discord 15:05 < richrd> why not read the output of the econ? 15:05 < richrd> but in any case cool project, thanks for sharing! 15:09 < bridge> [teeworlds] oh yea my project is a mess and @jxsl13 work shows that it is possible to work way cleaner with just python but i created some crazy shell pipes to achieve that 15:09 < bridge> [teeworlds] was the easiest for me and it is working fine in production since years 15:10 < bridge> [teeworlds] I stopped using python :D as the deployment is annoying, switched to Go. 15:11 < bridge> [teeworlds] compiled binaries ftw. 15:13 < Learath2> @LordSk shouldn't we be clipping instead of using a fake button? 15:14 < bridge> [teeworlds] Hum we could 15:14 < bridge> [teeworlds] I like it that way because it is very clear what's happening 15:22 < Learath2> (the fake button doesn't seem to be working btw 15:22 < bridge> [teeworlds] Yeah you can drag layers right? 15:22 < Learath2> I mean you can't click it sure, but hover effects still happen 15:22 < bridge> [teeworlds] Anything that is not tied to an ID will work 15:23 < bridge> [teeworlds] It is still a work in progress 15:23 < bridge> [teeworlds] I'm not sure what the right solution is just yet 15:27 < Learath2> problem with clipping is that only the render popup function knows the size of the popup 15:27 < Learath2> (I was going to do it but I couldn't figure out a nice way either) 16:37 < Dune> that was fast, Learath2 16:37 < Dune> are those strings localized? https://github.com/teeworlds/teeworlds/pull/2529/files#diff-6f58a256a8d771188dc01d94393ddbd8R2468 16:37 < Learath2> Oh, forgot that yea 16:39 < Learath2> Dune: apparently they weren't localized on the old editor and I'm not sure how to add new strings nowadays 16:39 < Dune> I think the new editor localizes this stuff 16:39 < Dune> how to add new strings -> I mean Localize("...") and you're done 16:39 < bridge> [teeworlds] just use `Localize`, done 20:13 < richrd> ChillerDragon how do you parse the TW logs? 20:14 < richrd> I see the server log has no escaping or anything. I changed my name to include spaces and single quotes and this is how the server log looks like [game]: team_join player='1:wa' vi k' team=0 20:14 < richrd> how am I supposed to get the player id and nick from that 🤔 20:16 < bridge> [teeworlds] oh i parse them poorly with my python crack code 20:17 < bridge> [teeworlds] didnt notice any parsing errors yet tho 20:17 < richrd> "crack code" :D nice 20:17 < bridge> [teeworlds] what r u interested in team_join ? 20:17 < bridge> [teeworlds] lemme get the code 20:18 < bridge> [teeworlds] https://github.com/chillavanilla/TeeworldsEconMod/blob/master/src/player.py#L163 20:18 < richrd> I kind of wanna parse everything, and write a bi-directiona python interface for teeworls 20:18 < bridge> [teeworlds] string.find and string.rfind is my friend 20:18 < bridge> [teeworlds] i barley use regex cuz python regex is always too much brain for me 20:18 < richrd> you have "player is on a killing spree" messages on your server, are they done with TeeworlsEconMod ? 20:18 < bridge> [teeworlds] yes 20:19 < richrd> that's pretty sweet 20:19 < bridge> [teeworlds] there are some known issues and limitations 20:20 < bridge> [teeworlds] i for example have one server in 0.6 and one in 0.7 and i use the same sqlite3 database and i got a blocking error once cuz both tried to access the db 20:20 < bridge> [teeworlds] i think most utf8 and unicode madness errors are solved nowerdays 20:20 < bridge> [teeworlds] but this was a issue for a long time 20:21 < bridge> [teeworlds] and if you start parsing be aware that not every connection message is followed by a disconnect message. There might be disconnects without connections in the log if the client gets kicked during connection phase etc. 20:25 < richrd> phew 20:27 < bridge> [teeworlds] but those are rare so if the first 100 hours testing worked doesnt mean its stable :p 20:31 < richrd> what does cbase.cfind do? 20:38 < richrd> i'm on this chat at Quakenet as well as Freenode, where's the official chat? 20:41 <@heinrich5991> quakenet 20:42 < richrd> where are the messages from [bridge] coming from? 20:42 < richrd> discord? 20:43 <@heinrich5991> yes 20:43 <@heinrich5991> https://discord.gg/teeworlds 21:12 < bridge> [teeworlds] @ChillerDragon https://regex101.com 21:13 < bridge> [teeworlds] all you need to know is regex and how capture expressions work, basically everything within parenthesis in your regex can be extracted individually. 21:25 < bridge> [teeworlds] yea i know regex i like to use it in bash 21:25 < bridge> [teeworlds] but im usually too lazy to look up py syntax 21:27 < bridge> [teeworlds] it's the same, just with some ugly extensions, that make the usage more convenient :D 21:29 < bridge> [teeworlds] macOS -> Dash app 21:30 < bridge> [teeworlds] macOS -> Alfred 21:30 < bridge> [teeworlds] best combination 21:42 < richrd> ChillerDragon I cant figure out how you track player names.. I just named myself player='99:hax' and your mod correctly recognizes me and doesn't get confused 21:43 < richrd> do you store the player name on connect and then rely on just the player id for all other events? 21:44 < richrd> the server sends lines like this [game]: pickup player='0:wa' vi' item=1 (payer name there is "wa' vi") but the single quotes aren't escaped :< 21:49 < richrd> when a player joins the first line in the logs with their name is "[game]: team_join player='0:playername' team=0". If i can assume the player id and name is between the first and last single quote I can store the player details and later just match the player based on the id (i think) 23:12 < bridge> [teeworlds] yea about the single quotes i do a string find of "player='" and "' item=" and match everything in between no matter if there are quotes 23:13 < bridge> [teeworlds] and also your assumption is correct 23:13 < bridge> [teeworlds] keep in mind not to use a fixed offset of two from the first quote because ids can be 2 digits i think 23:14 < bridge> [teeworlds] i do not know exactly it changed in 0.6 and 0.7 and sometimes they were even hex 23:14 < bridge> [teeworlds] so do tests with higher ids 23:15 < bridge> [teeworlds] I used to do everything name based but I think i moved some things to id based especially since 0.7 supports duplicated names 23:18 < bridge> [teeworlds] <1stDecadeTW> What about improving the server side bot? It is a great idea to keep it joined when the server is empty and for balancing purposes, but it's bit too dumb, it keeps falling down all the way around. 23:25 < bridge> [teeworlds] @1stDecadeTW ask @nheir /rand 23:25 < bridge> [teeworlds] he's doing that kinda? 23:25 < Dune> probably not, since the time 23:25 < Dune> but it's an open issue :) 23:27 < bridge> [teeworlds] @richrd a nickname cannot change as of 0.7 after you connect to the server 23:27 < bridge> [teeworlds] it stays the same until you reconnect, at least server side 23:28 < richrd> thanks for the pointers! really helps, since I'm just starting out 23:29 < richrd> i started matching stuff partly manually and partly with regex and seems promising for now... 23:29 < bridge> [teeworlds] regex does work perfectly fine, I'm also using it in my discord econ bot 23:30 < bridge> [teeworlds] <1stDecadeTW> nheir/rand bots are one of the best bots right now, but they are too strong, they all behave the same, they don't have any strategies as humans in-game, just "get flag, kill and destroy", so it makes it boring after a while 23:30 < richrd> seems that the regex approach handles the quote issue properly 23:30 < bridge> [teeworlds] I would add $ at the end of some of those regex, as sometimes people might use quotes as nickname 23:31 < bridge> [teeworlds] to match the end of the line 23:31 < bridge> [teeworlds] https://github.com/jxsl13/TeeworldsEconDiscordModerationBot/blob/master/server.go 23:32 < wavi> I'm doingstuff like: player='(\d{1,2}):(.*)' 23:32 < wavi> its greedy and gets the quotes within the nickname 23:33 < bridge> [teeworlds] does it get mmultiple quotes as well :o? 23:34 < wavi> yeah, even though it surprises me quite a bit 23:34 < wavi> for this log line: [game]: team_join player='0:' team=9' team=0 23:34 < bridge> [teeworlds] inrteresting 😮 23:34 < wavi> i get: ('0', "' team=9", '0') 23:35 < wavi> i tried to confuse it by settimg my nick to: ' team=9 23:36 < bridge> [teeworlds] set your nick to player='5:a' 23:36 < bridge> [teeworlds] x) 23:38 < wavi> still works 😮 23:38 < wavi> DATA: [game]: team_join player='1:player='5:a'' team=1 23:38 < wavi> MATCHED: ('1', "player='5:a'", '1') 23:39 < bridge> [teeworlds] then it seems fine 😮 23:40 < wavi> kind of blows my mind but I guess i'll just hope this will always work