Solved Score reset bug

Question that is answered or resolved.

dantedevil

Well-known member
For some time now, I've been trying to fix an annoying bug that resets my score to 0 when I start the next stage. :(

It's important to note that I'm using OpenBoR v3.0 Build 7123. 👈

When I searched the forum, I only found some related information that referred to "skipselect. 🤔
So I decided to try removing all the "skipselect" statements from my "levels.tx" file, but the bug persists. 😒

I'm completely lost with this problem and I don't know what to do to fix it. 😩
 
Solution
I finally found the problem! 😅

There was a conflict in "endlevel.c" with the script for the "STRIKEBALL" minigame in "PARTY" mode. :(

Here the original endlevel.c:
C++:
#include "data/scripts/story/story_clear.c"

void main()
{
   clearStory();
{
    int Skor = getglobalvar("Win1");

    if(!Skor || Skor<=0){
      Skor = 0;
    }

   setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
    setindexedvar("Lesn", NULL());
    setindexedvar("Wait", NULL());
    setindexedvar("Dead", NULL());
    setglobalvar("Equalo", 5000);
    setindexedvar(1, NULL());
    setindexedvar(2, NULL());
    setindexedvar(3, NULL());
    setindexedvar(4, NULL());
    setindexedvar(5, NULL());
    setglobalvar("F1", NULL());
    setglobalvar("F2"...
It's important to note that I'm using OpenBoR v3.0 Build 7123

Well, to start with, that's not an official release. The last stable release of 3.0 was 6391, and OpenBOR 4.0's first release was build 7553. So you're effectively running an unsanctioned development build. That's pretty much asking to have bugs.

Though that said, I'm not aware of a scoring bug anywhere in any version of the engine. It's most likely getting reset by a scripting conflict somewhere. Score is a player property, so that's where I would start looking. If you can't find it, you could always do a workaround of storing the current score getplayerproperty( int player_index, "score"); as a globalvar when levels end, and then adding it back when the next level starts.

HTH,
DC
 
I finally found the problem! 😅

There was a conflict in "endlevel.c" with the script for the "STRIKEBALL" minigame in "PARTY" mode. :(

Here the original endlevel.c:
C++:
#include "data/scripts/story/story_clear.c"

void main()
{
   clearStory();
{
    int Skor = getglobalvar("Win1");

    if(!Skor || Skor<=0){
      Skor = 0;
    }

   setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
    setindexedvar("Lesn", NULL());
    setindexedvar("Wait", NULL());
    setindexedvar("Dead", NULL());
    setglobalvar("Equalo", 5000);
    setindexedvar(1, NULL());
    setindexedvar(2, NULL());
    setindexedvar(3, NULL());
    setindexedvar(4, NULL());
    setindexedvar(5, NULL());
    setglobalvar("F1", NULL());
    setglobalvar("F2", NULL());
    setglobalvar("F3", NULL());
    setglobalvar("NoBall", NULL());

    changeplayerproperty(0, "score", Skor);
}
}

And here the updated:
C++:
#include "data/scripts/story/story_clear.c"

void main()
{
    clearStory();

    int Skor = getglobalvar("Win1");

    if(Skor && Skor > 0)
    {
        changeplayerproperty(0, "score", Skor);
    }

    setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
    setindexedvar("Lesn", NULL());
    setindexedvar("Wait", NULL());
    setindexedvar("Dead", NULL());
    setglobalvar("Equalo", 5000);
    setindexedvar(1, NULL());
    setindexedvar(2, NULL());
    setindexedvar(3, NULL());
    setindexedvar(4, NULL());
    setindexedvar(5, NULL());
    setglobalvar("F1", NULL());
    setglobalvar("F2", NULL());
    setglobalvar("F3", NULL());
    setglobalvar("NoBall", NULL());
}

Now all works ok! :)

You were right @DCurrent , thanks! 💪
 
Solution
I finally found the problem! 😅

There was a conflict in "endlevel.c" with the script for the "STRIKEBALL" minigame in "PARTY" mode. :(

Here the original endlevel.c:
C++:
#include "data/scripts/story/story_clear.c"

void main()
{
   clearStory();
{
    int Skor = getglobalvar("Win1");

    if(!Skor || Skor<=0){
      Skor = 0;
    }

   setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
    setindexedvar("Lesn", NULL());
    setindexedvar("Wait", NULL());
    setindexedvar("Dead", NULL());
    setglobalvar("Equalo", 5000);
    setindexedvar(1, NULL());
    setindexedvar(2, NULL());
    setindexedvar(3, NULL());
    setindexedvar(4, NULL());
    setindexedvar(5, NULL());
    setglobalvar("F1", NULL());
    setglobalvar("F2", NULL());
    setglobalvar("F3", NULL());
    setglobalvar("NoBall", NULL());

    changeplayerproperty(0, "score", Skor);
}
}

And here the updated:
C++:
#include "data/scripts/story/story_clear.c"

void main()
{
    clearStory();

    int Skor = getglobalvar("Win1");

    if(Skor && Skor > 0)
    {
        changeplayerproperty(0, "score", Skor);
    }

    setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
    setindexedvar("Lesn", NULL());
    setindexedvar("Wait", NULL());
    setindexedvar("Dead", NULL());
    setglobalvar("Equalo", 5000);
    setindexedvar(1, NULL());
    setindexedvar(2, NULL());
    setindexedvar(3, NULL());
    setindexedvar(4, NULL());
    setindexedvar(5, NULL());
    setglobalvar("F1", NULL());
    setglobalvar("F2", NULL());
    setglobalvar("F3", NULL());
    setglobalvar("NoBall", NULL());
}

Now all works ok! :)

You were right @DCurrent , thanks! 💪

Awesome! Glad you got it working @dantedevil!

DC
 
Back
Top Bottom