Daily event system not working for some unknown reason

Hi, I’ve recently been trying to make a daily event system that gets the current day and year from a server, then compares it to some stored variables and if the time is greater, it sets a boolean to true and allows you to get the rewards

that’s (sorta) of an oversimplification, so if you’d like you can watch the tutorial that I’m basing my code on (https://youtu.be/C60MfGt6keg?si=Sb9-igKIDai8gCrX)

for some context, all of my serverside data that i’m pulling is exactly the same as the clientside data he gets in his video (yes i have checked all the data looks perfect in the inspector) and i’ve even tried doing a clientside test version, which didn’t work either. From my numerous hours of debugging it i see that the action to change the lasteventday & lasteventyear work perfectly fine, but for some reason it doesn’t set the “eventready” boolean to true, i’ve also asked for answers like 3 times in this discord, and in winstreak (the creator of the tutorial’s) discord since someone reccomended it to me on the gdevelop discord, but i just got ignored.

I genuinely don’t understand why it doesn’t work when the code is the EXACT SAME as his tutorial, this system is genuinely so simple too so it’s probably just one small typo or order of events error, but absolutely nobody i’ve asked has been able to find it and it’s kinda driving me crazy since i’ve worked on this game for so long and the thing that’s holding me back from it being ready to test is a simple little daily login system

anyways, tldr is that i’m looking for someone to maybe find an error in my code that’s different than the tutorial, or someone who knows a functional way to make a daily login system (even one that’s only getting the device’s time! i can easily port it over)

here’s the images ↓

1 Like

Looking at his code and yours, I see his is on the older version that had the specific events for the data type. Since you’re on the newer one, I wonder if the JSON is being put in those variables as a string, rather than number, so its comparing a number to string and never comes back as true.
Edit: double checking the video, I’m positive this is it. I’d convert the JSON string into a number for the comparison, or using compare two numbers condition put your data variable structure inside of a ToNumber(). Actually, I think you can use the conditions as is, just put it as ToNumber(data.xyz) and I believe it should work.

did you read the message fully? yes i’ve checked the inspectors, all the data looks fine and i’ve tried a clientside version which is identical, so no. it’s not that :slight_smile:


Ah, I did read that part, but didnt see where it was converting from a string to a number in the events. My bad.

no worries! i’m just confused why this doesn’t work :sweat_smile:

It all looks like it should, and recreating your events exactly on a new project DOES work, assuming all variables are set to 0, “”, or false in the variable menu when they’re declared. Maybe try doing so yourself to rule out anything extra weird, and if it does still work, somewhere else in the events has to be doing something to it.


I’ve added a screen of my recreation of it; just in case my brain auto fixed anything. I believe the only difference is some camel casing in my variable names, and the Z order being set to the chest’s + 1 instead of 0.

Just a few clarifying questions, what are the global variables you are referencing, where is your action to save since it is not in the obvious spot of when the user touches the treasure chest, how are you determining that the bool isn’t true is it just because the TimeofDayLeft text remains hidden?

  1. Watch the tutorial I linked, and the “data” & “rawdata” variables are pulled from the web, “rawdata” being the jumbled up json & "data: being a structure with all the values
  2. I assume i should’ve clarified but this is a test scene, i’ve tried it with a save & load system in the main scene but i didn’t work, so i tried a few tests in this scene (while keeping my computer open so the data isn’t lost)
  3. I’ve debugged about every part of this so I know exactly what happens just by constantly looking at the debugger, that’s the only out of the ordinary thing i’ve noticed other than that it’s working exactly as intended

I did watch the tutorial and that was why I wondering about the global variables there and scene variables everywhere else, since that is not done in the video. Part of my mind gave you credit for storing all your scene variables into a global structure for whatever your use case might be, but since you did not share the events changing the global variables to match the scene variables lasteventday/year, I worried they might be 0.

For clarity gp.lasteventday and gp.lasteventyear.

just realized I used the wrong variable, sorry for all the hassle that’ll probably fix it :sob:

1 Like

I hope it does fix it, or at least get you closer to the solution. It’s not a hassle, this was obviously something easy to miss or else someone on Discord would have quickly pointed it out and you would not have spent days of frustration over this. But hopefully you can move forward with your project now and put these dark days behind you.