Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Math is hard

6 years ago
This was supposed to be something quick and simple to play around with this morning, and instead I'm just utterly stumped here.

What I have is essentially:

%RNG := 30D3
%NEWSTUFF := %NEWSTUFF + %RNG

in one link. Another link is supposed to collect the total until you clean it out, so in there I have:


%TOTALSTUFF := %TOTALSTUFF + %NEWSTUFF

some unrelated things, and then at the end:

%NEWSTUFF := 0


I thought if anything I'd have some trouble with resetting %NEWSTUFF at the end, but instead for no reason I can understand, every time I go to collect the total, it doubles it. Like, start with a total of zero, collect 64 new stuff, and I then have 128. Do it again and I have 256. There's only two links effected here and I've been switching back and forth staring at them for awhile now and I just don't know what the fuck.

Math is hard

6 years ago
Okay so apparently what I needed to do was clear the random variable immediately after clicking the first link, because for whatever reason clicking any other link on the page would continue to increase it which would continue to increase the other total.

This makes no sense and I am very annoyed. It also means I have to go in an unfuck a whole bunch of $PAGETEXT stuff that was spitting out the random variable, and there's another bit that was using a similar system that's going to be more complicated to test, but is probably also broken in the same way.

Math is hard

6 years ago
Was the code in the link itself?

Math is hard

6 years ago
Yes, but clicking other, empty links that refreshed the page still triggered it.

The whole game was just something I was toying around with so it's not actually that big a deal. I may go back in and try to pinpoint exactly what was going on with it but it won't be before the weekend.