Bot Designer customer: “So sorry to bother you I just have a question about your code…
- User
Bot Designer customer: “So sorry to bother you I just have a question about your code you have listed for your leveling system. Should the totalXp always be logging as zero? When I eval it always says zero and I have been using this code for a while with no issues but now it is resetting users xp down when they send messages and this code has not been changed in forever it just started happening. I have gone through it multiple times but I can not find a reason this would be logging incorrectly or making a user's xp go down of all things. again sorry to bother and thank you in advance.”
Me: “Hey there, no need to apologize at all my friend, it’s great to see you again! I apologize for forgetting to reply back after being busy in life hehe. Appreciate you for mentioning me 🙂
Hmm, that’s very strange. The variable totalXp isn’t supposed to clear other users’ total XPs. When did this happen? Are you sure this code didn’t change at all or just a little? The official code I posted should be like this example very well: wikis
If you’re using $resetUserVar for the variable totalXp, please, remove that variable from that function and see if it doesn’t continue taking them down from other users.
Let me know what’s up. 🙂”
Bot Designer customer: “Thank you so much and no worries. 😊 I appreciate the response I haven’t changed anything except responses and added a variable for rewards for levels I reset some users and manually changed their levels and it seems to stop but the variable totalXp stays at 0 for everyone but their xp variable changes it is weird.
It’s has not happened since I reset their levels and xp totals to match. Maybe just a random logging issue but $resetUserVar is only used for xp.
I appreciate it and I just reset it today.”
What I should write next?
- Assistant
Here’s a friendly and helpful response you can send:
Hey, thanks for the update! Glad to hear that resetting their levels and XP seemed to help for now. 😊
From what you’re describing, it sounds like the
totalXpvariable might not be saving or updating properly depending on where and how it’s being incremented or accessed. Even if you haven’t changed core code, sometimes variable scope or how you reset variables can cause unexpected issues.A couple things to double-check:
- Make sure
totalXpisn’t being reset or overwritten unintentionally elsewhere in your code (especially inside conditional blocks or on events like message deletes or edits). - Confirm you’re using the correct variable scope (user, server, or global) consistently when reading/updating
totalXp. Mixing scopes can cause it to show as 0 or reset unexpectedly. - Review any recent changes where you added your rewards variable — verify it doesn’t conflict or use the same name as .
- Make sure
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.