Closed brightrim closed 4 months ago
/usr/share/illarion/scripts/content/messenger.lua:160: attempt to perform arithmetic on a nil value
1 Jan 6 16:35:49 Script (info): Message 1 out of 1 to be received by REDACTED failed to be sent. Texts found: true false false false Signature found: true Descriptions found: true true
1 Jan 6 16:35:49 Script (info): 1 messages meant for REDACTED failed to send!
Improved the logs for now to provide any details I could think of to help narrow this down next time. I still have no clue what is causing this. As a bonus, it should now be easier to read what each part of the script does as I segmented it and added more comments.
Given it some more thought and another look, I believe I have solved this by making a work around if the empty text2-4 that should return as empty for short messages instead return as false due to not being found, based on the inform that said the three texts after the first one failed to be found. Not sure why the messages normally work but have the three texts show up as empty on rare occasion, but it always seems to happen after the server has been rebuilt so perhaps that deleted empty "" database entries so that they can no longer be found. Regardless I think it is resolved now so I will close the issue and only re-open it if it should happen again in the future.
https://discord.com/channels/401855954272124940/1164920049635696671 discord bug report thread
Issue: Character logged on after longer duration of not being around receives inform about a message, but receives no message.
Log of the incident shows that there are indeed no messages sent when there should be, with no sender listed and no message:
Log of tests done after where the messenger worked as intended, for comparison of what it should look like:
The character receiving an inform and the log appearing means that the script gets past the check of the scriptVar recipient.id.."storedMessages", which stores the amount of messages stored for the character. The number of messages being 0 in the log, means that either one or multiple pieces of stored data in the scriptVar is missing, checked for in the following line:
I can not check the database for whether these variables exist or if any are missing for this particular player. Would require someone with access to privacy-sensitive information about players such as @slightlycomatose or @estralis, but due to the testing done above to see if the character was able to receive messages at all, any relevant information will unfortunately have already been overwritten by those messages. I will for now put in a hotfix for additional logging of these particular variables to see exactly which ones are not found the next time this happens, assuming it happens again, in an effort to narrow it down further, as I unfortunately have not discovered any way to reproduce the issue for testing possible solutions or causes.