thebigsleepjoe / TTT-Bots-2

Player bots for Garry's Mod TTT
Creative Commons Attribution Share Alike 4.0 International
11 stars 4 forks source link

client convars don't exist, cause errors #3

Closed EntranceJew closed 10 months ago

EntranceJew commented 10 months ago

affected convars:

ttt_bot_pfps
ttt_bot_pfps_humanlike
ttt_bot_emulate_ping

I stubbed out these checks locally with true or prior to the check, and can confirm that the bots are fully compatible with TTT2.

image

Except this error:

[ttt-bots-2] addons/ttt-bots-2/lua/tttbots2/commands/concommands.lua:24: attempt to call method 'Nick' (a nil value)
  1. unknown - addons/ttt-bots-2/lua/tttbots2/commands/concommands.lua:24
   2. unknown - lua/includes/modules/concommand.lua:54

But that could be an incompatibility with something else I've got.

thebigsleepjoe commented 10 months ago

I'll look into the cvar error. I thought it was setup to replicate to the client, so that is a little concerning.

Could you provide a modlist or something so I can replicate the latter error? I haven't quite experienced that on TTT or -2.

Also, I see in the screenshot a bot said, "Plan.Attack---". Is this a result of a tweak you made, or have the bots been saying the unformatted strings during your testing?

EntranceJew commented 10 months ago

Using the cvar definitions with the table format, e.g.

local flags = {FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY}
local dib_enable = CreateConVar( "dib_enable", "1", flags, "Enables item / weapon highlighting" )

has been a lot easier to manage, but when i cloned it, those convars didn't even exist in the repo anywhere else; no CreateConVar statement, no ability to GetConVar.

They have been saying unformatted strings periodically, but not all the time.

my own addon probably broke the :Nick thing with something i was trying to implement so i don't think it's a major deal if you haven't seen it in your dedicated server logs

thebigsleepjoe commented 10 months ago

While looking into the Facepunch wiki, I found that replicated cvars should also be located on the client for consistency, so I will make a shared cvars file for those. I suppose it makes sense that it would be fine if you define it server-side on a P2P server, but wouldn't work on dedicated servers.

I actually haven't tested the mod on SRCDS yet tbh, only P2P. When the bots say the unformatted strings like you saw, what do they usually say? Is it always something in traitor chat?

thebigsleepjoe commented 10 months ago

Sorry, marked as completed by mistake. Still need to test on SRCDS, latest commit is working on P2P

EntranceJew commented 10 months ago

Yeah, they were previously always using the unformatted strings in team chat.

Testing latest shortly.

thebigsleepjoe commented 10 months ago

I confirmed pfp issue was resolved on SRCDS. There are a few issues I'm noticing on dedicated servers so I will work on that next and move the unformatted strings problem to a new issue. Thank you for the report!