Closed zambony closed 9 years ago
It already wraps I'm using markup (meaning you can use the font and color HTML tags in your text). I tried announcing long text and had no issues I don't know if the crash is caused by the GUI or the networking.
That's odd. I typed out a sentence (about 40 characters) and I lagged briefly, then my game proceeded to crash and gave me the error "STACK OVERFLOW" or something to that effect.
Are you on singleplayer / listenserver?
I was on a listen server, yes. I assume that must be the problem then...
Here is what wrapping looks like http://steamcommunity.com/id/_fr_starfox64/screenshot/713029906825849449
Are you running the latest update that was pushed yesterday? I'd like to see is if bromvlieg changes fixed it.
The latest version gm_bromsock? Yes. And FoxedBot*
I'm actually thinking now that it might be due to the fact that I added the avatar of the player who sent the announcement next to the header. Somehow... EDIT: Just kidding, tried it on a fresh version of the file. Still crashes.
Could you remove your modifications, do some testing with the latest versions and tell me if you are still experiencing issues.
Done on a fresh installation in singleplayer, crashed me. Are you pasting in text that is already wrapped (lorem ipsum generators) or are you typing out a string? I've just been typing out long sentences with no newline characters.
Error message
I'm having no issues when sending very long strings (max SteamChat length). However I'm pushing a fix to ignore errors on the listening socket.
Could it be a result of the server port I have set for it? 27015 for server and 25000 for listening
Well yes it is, the server port (as said in the README) isn't source's it's a unique port per server reserved for FoxedBot.
Well if FoxedBot.ServerPort
is anything other than 27015, commands sent to the bot don't go through.
Oh dear god I really am dumb. Changed the port in settings.js on the bot's end to 25100 and it works, same with text wrapping. Ok.
Well thanks for your help, sorry for the trouble!
EDIT: Nevermind, text wrapping works but I still crash with long messages.
Does the server or the client crash?
Well unfortunately I don't have the luxury of having a dedicated server, so I'm on a listen server, and I can't tell which crashes since the game closes out and gives me the error "hl2.exe has encountered an error and needs to close"
Is it only when the text is "too long"? Try using chat instead and tell me if it does it too.
Yes it crashes too with chat, but it tolerates longer messages before crashing.
Oh and I was wondering, why do you need FoxedBot for a listen server? (I don't think I'll be able to help you there) What is considered too long?
Well I'm the developer for a community and we don't have a dev server, so I have to resort to using singleplayer. As well, I'm hesitant to live-test it on the server if it does indeed crash when sending chat messages and announcements.
Too long seems to be more than 35 characters, no line breaks or newline characters.
Do you get this when sending an rcon command?
Yes.
So this is a server issue, does the server ever gets empty so you can test FoxedBot on it?
Our server usually has anywhere from 26-42 people on it, and by the time it is empty, it's about one in the morning and I don't want to be falling asleep while trying to test things. I'll see if I can borrow a friend's server later, but I don't know if he'll let me.
Ok, sorry but at this point I have no more hints.
All right, thank you for trying anyway. I'll maybe comment again if and when I get to try it on a real server.
Got a dedicated server and when I look in the console, when sending a large announcement or chat message, the console prints this error and will actually most of the time crash the server
[FoxedBot] Received an invalid packet.
Exact amount of characters it will allow is 47
Could you install something like wireshark, send the packet to an external IP (not loopback else it won't capture it) and send me the content of the failed packets.
Never used wireshark before. How exactly would I do this?
Long !chat message crashes the server with this error
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Attempting to print the table being sent to the server. Shorter messages successfully print the table, longer ones throw this error
[ERROR] lua/includes/util.lua:43: bad argument #1 to 'pairs' (table expected, got nil)
1. pairs - [C]:-1
2. PrintTable - lua/includes/util.lua:43
3. unknown - addons/foxedbot/lua/foxedbot/sv_foxedbot.lua:18
4. v - [C]:-1
5. unknown - lua/includes/modules/hook.lua:84
First off, in the bot settings.js, select an external IP for a server, if you choose 127.0.0.1 it won't work. In wireshark select your network adapter and click start, send an announcement to the server with the external IP then stop the wireshark capture and look for the packet that was sent. and show be the packet in HEX.
In filters you can type tcp to remove all the useless packets.
I can't exactly copy the hex. Would a picture work?
Yup
Here is the packet I selected which pops up when I send announcements that are too long.
And here is the hex
Can you show me a packet that works too?
Sorry, wrong packet. http://puu.sh/ggBaU.png
Here's a packet that is showing different information when I send messages that are too long:
That last one isn't working right? also can you post the full packet, this one is missing the first part.
whoops, sorry about that and yes the last one doesn't go through
In lib/functions.js at line 72 could you add console.log(size);
, and send a couple message (short and long ones) and tell me if you see any values that seems too big.
All of them went through except the last one.
Could you send The last one again (Exact same message) and capture the packet using wireshark.
In lib/function.js can you replace sendToServer with this and tell me what happens. (If it fails can you send me the packet)
https://gist.github.com/Starfox64/6971b4d1eb3be47c20ce
May I ask you where you get this from?
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
The bad_alloc comes from what I assume is going over the limit for chat.AddText If I send a message with !chat that is very long, it takes down the server with that error.
Now even short messages don't go through.
Does the server crash?
I meant where do you find that error not how.
The server doesn't crash with the new modifications, the message just doesn't appear on the server.
And the other error I find in my console right after it crashes from chat.
Oh Ok thats because you are running a dedicated server I understand now.
I'm gonna look into the new code.
I just updated the gist, try the new code it was a dumb mistake. https://gist.github.com/Starfox64/6971b4d1eb3be47c20ce
I decided to check out what would happen if I typed out a full message (whether it would wrap or not) and.. well... it crashed my game. I tried editing the code to wrap the text to the panel, but then I realized you overwrote PANEL:SetText() to just draw text, so I wasn't sure how to get that to wrap.