Modifying Custom Pause Menu Issue

maxman

Well-known member
The custom pause menu script which was created by @Kratus himself, works wonders! It really works for my Street Fighter project and any other mod. However, it doesn't display itself in my Rhythm of Destruction mod. Despite using the same code from both the template and my SF project, it doesn't show in ROD.

This is my update.c for ROD.
C:
#import "data/scripts/dc_bug_patch/continue_timer.c"
//#import "data/scripts/menu/pauseMenu.c"

void oncreate()
{
}

void ondestroy()
{
}

void main()
{
    /*
    * Execute the bug patch function.
    * The numeric value is allowed
    * continue time in game seconds.
    * Native engine default is 10.
    */
    int continue_time = 20;

    dc_continue_bug_patch(continue_time);

    LastNumber();
    //titleMusic();
    if(pausingGo()) result;
}

void titleMusic()
{
    if(openborvariant("in_menuscreen") || openborvariant("in_titlescreen"))
    {      
        if(getlocalvar("MusicMenu") == NULL())
        {
            playmusic("Data/Music/versus.bor", 1);
            setlocalvar("MusicMenu", 1);
        }
    }
    else {if(getlocalvar("MusicMenu") != NULL()) setlocalvar("MusicMenu", NULL());}
}

void LastNumber()
{
    //if(pausingGo()) return;

    if(openborvariant("in_level"))
    {
        int P1 = getplayerproperty(0, "entity");
        int P2 = getplayerproperty(1, "entity");
        int P1Life = getplayerproperty(0, "lives");
        int P2Life = getplayerproperty(1, "lives");

        if(P1)
        {
            drawstring(131, 2, 3, P1Life-1);
        }

        if(P2)
        {
            drawstring(311, 2, 3, P2Life-1);
        }

    }
}

void pausingGo()
{
    //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }

    //CHECK IF THE PLAYER IS IN A LEVEL
    if(openborvariant("in_level")){
        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 3;
        int min            = 0;
        int add            = 1;

        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        if(openborvariant("game_paused") && !openborvariant("in_options")){

            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
              
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
              
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }

            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
              
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);

                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
                }

                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }

                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    setglobalvar("menuPause", 0);
                    playgif("data/scenes/howto.gif");
                }

                //END GAME
                if(menuPause == 3){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
                }
            }

            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int yAdd        = 11;
            int layer        = 50000000; //-1000000003;

            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS HOW TO PLAY HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}        //IS END GAME HIGHLIGHTED??

            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);

            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);

            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);

            yPos = yPos+yAdd;
            str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);

            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);
        }

        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }

        //NECESSARY STEPS THAT NEEDS TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUNS OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){

            //END GAME
            if(menuPause == 3){gameover();}
        }
    }
}

I don't understand why it's not working at all.

Another issue I have is that I'm trying to include a certain model as a music option or something else. And I have to press anybutton and then escape button, to look at the music menu. Sometimes, I press "anybutton", "start", and then "escape", just to look at it too. I removed playgif and (excluded) setglobalvar("menuPause", 0) from the 3rd option, so I could input the music menu as an option in the pause menu.

Here is the invisible music entity as a list of music selection.
C:
name MusicSelect
type text
shadow 0

anim idle
@script
    void self = getlocalvar("self");
    int index = getentityproperty(self, "playerindex");
    void up = playerkeys(index, 0, "moveup");
    void down = playerkeys(index, 0, "movedown");
    void pick = playerkeys(index, 0, "anybutton");

    int Cframe = getentityproperty(self, "animpos");

    if(frame >= 1)
    {
        if(Cframe == 3 && down){updateframe(self, 4);}// NO SOUND TO BEGIN
        if(Cframe == 6 && up){updateframe(self, 7);} // SOUND TO GO UP
        if(Cframe == 9 && down){updateframe(self, 4);} // SOUND TO GO DOWN

        if(Cframe == 3 && pick){fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5); updateframe(self, 24); }
        if(Cframe == 6 && pick){fademusic(0.5, "data/music/dojo/002.ogg", 1, 43526.7); updateframe(self, 24); }
        if(Cframe == 9 && pick){fademusic(0.5, "data/music/dojo/001.ogg", 1, 470767.5); updateframe(self, 24); }
    }

@end_script
    delay 11
    offset 1 1
    frame data/chars/0misc/empty.gif # 0
    @cmd settextobj 0 60 50 1 999999999 "001"
    @cmd settextobj 1 60 60 0 999999999 "002"
    frame data/chars/0misc/empty.gif # 1
    frame data/chars/0misc/empty.gif # 2
    @cmd updateframe getlocalvar("self") 2
    frame data/chars/0misc/empty.gif # 3
    sound data/sounds/beep.wav
    @cmd settextobj 0 60 50 0 999999999 "001"
    @cmd settextobj 1 60 60 1 999999999 "002"
    frame data/chars/0misc/empty.gif # 4
    frame data/chars/0misc/empty.gif # 5
    @cmd updateframe getlocalvar("self") 5
    frame data/chars/0misc/empty.gif # 6
    sound data/sounds/beep.wav
    frame data/chars/0misc/empty.gif # 7
    @cmd settextobj 0 60 50 1 999999999 "001"
    @cmd settextobj 1 60 60 0 999999999 "002"
    frame data/chars/0misc/empty.gif # 8
    @cmd updateframe getlocalvar("self") 8
    frame data/chars/0misc/empty.gif # 9
    sound data/sounds/beep.wav
    frame data/chars/0misc/empty.gif # 10
    @cmd settextobj 0 60 50 0 999999999 "001"
    @cmd settextobj 1 60 60 1 999999999 "002"
    frame data/chars/0misc/empty.gif # 11
    @cmd updateframe getlocalvar("self") 11
    frame data/chars/0misc/empty.gif # 12
    frame data/chars/0misc/empty.gif # 13
    frame data/chars/0misc/empty.gif # 14
    frame data/chars/0misc/empty.gif # 15
    frame data/chars/0misc/empty.gif # 16
    frame data/chars/0misc/empty.gif # 17
    frame data/chars/0misc/empty.gif # 18
    frame data/chars/0misc/empty.gif # 19
    frame data/chars/0misc/empty.gif # 20
    frame data/chars/0misc/empty.gif # 21
    frame data/chars/0misc/empty.gif # 22
    frame data/chars/0misc/empty.gif # 23
    frame data/chars/0misc/empty.gif # 24
    frame data/chars/0misc/empty.gif # 25
    frame data/chars/0misc/empty.gif # 26
    frame data/chars/0misc/empty.gif # 27
    delay 2
    @cmd cleartextobj 0
    @cmd cleartextobj 1
    @cmd killentity getlocalvar("self")
    frame data/chars/0misc/empty.gif # 28
    frame data/chars/0misc/empty.gif # 29

update.c:
C:
void main()
{
    //SONG SELECTION IN THE PAUSE MENU ONLY IN THE THIRD GAME MODE
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }

    //CHECK IF THE PLAYER IS IN THE THIRD GAME MODE
    if(openborvariant("in_level") && openborvariant("current_set") == 2){

        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 3;
        int min            = 0;
        int add            = 1;

        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        if(openborvariant("game_paused") && !openborvariant("in_options")){

            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
              
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
              
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }

            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
              
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);

                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                    //changeplayerproperty(0, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(1, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(2, "newkeys", openborconstant("FLAG_START"));
                    //changeplayerproperty(3, "newkeys", openborconstant("FLAG_START"));
                }

                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }

                //HOW TO PLAY
                /*
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    setglobalvar("menuPause", 0);
                    playgif("data/scenes/howto.gif");
                }
                */

              
                //SELECT MUSIC
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("menuPause", 0);
                    void vSpawn = spawn();
                    loadmodel("MusicSelect");
                    setspawnentry("name", "MusicSelect");
                }
              

                //END GAME
                if(menuPause == 3){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
            }

            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int yAdd        = 11;
            int layer        = -1000000003;

            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS SELECT MUSIC HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}        //IS END GAME HIGHLIGHTED??

            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);

            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);

            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);

            yPos = yPos+yAdd;
            str = "Select Music";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);

            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);
        }

        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }

        //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){

            //END GAME
            if(menuPause == 3){gameover();}
        }
    }
}

I don't like when I have to press any button on a different option, and then the escape button after. I want to press any button on that particular option like I do to any option in the pause menu. How can I achieve pressing any button effortlessly without requiring button combinations? The music menu is a text type entity.

8-4-2023 12-50-34 PM.png

FFp_demo_001 - 0012.png
 
Last edited:
Like I said before, the ESC key effect does the trick. In the example below I maintained the ESC detection in case you want to apply other effects, but you can remove it once it already had the desired effect.

C:
void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    drawstring(50, 50, 0, "New Menu");
    drawstring(50, 60, 0, "Press any key to quit");

    if( playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||
        playerkeys(2, 1, "anybutton")||
        playerkeys(3, 1, "anybutton")||
        playerkeys(0, 1, "esc")|| //DETECT ESC KEY PRESS
        playerkeys(1, 1, "esc")||
        playerkeys(2, 1, "esc")||
        playerkeys(3, 1, "esc")){
       
        //DISABLE THE NEW MENU IF ANY ACTION KEY IS PRESSED
        setglobalvar("newMenu", NULL());
        setglobalvar("menuPause", 0);

        //DISABLE ANY ACTION KEY NATIVE EFFECT AND APPLY THE ESC KEY EFFECT
        changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
        changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
        changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
        changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
    }
}

Yes! That's exactly it! That's what I'm talkin' about! Thank you very much, Kratus!

Is it okay if I send you a PM on what I have for the level transition issue? If not, I'll wait for your reply here.
 
Yes! That's exactly it! That's what I'm talkin' about! Thank you very much, Kratus!
Glad to help :)

Is it okay if I send you a PM on what I have for the level transition issue? If not, I'll wait for your reply here.
Sorry friend, I don't understand the connection of the level transition with the pause menu. And I suggest keeping the discussion here instead of PM, this way everyone can see the solutions applied.
 
Sorry friend, I don't understand the connection of the level transition with the pause menu.
I'm very sorry for not including what I updated in update.c. I forgot to mention that I included #import thru spawn004.c in update.c after I updated it with connecting the level transition. That's how I connect the level transition with the pause menu. The time I showed the code was when I didn't import it for the level transition. I posted the whole code of spawn004.c some posts ago, but this time, not in keyall.c.

Only in update.c.
C:
#import "data/scripts/spawn004.c"

I can post the whole thing of the latest update in update.c if you like.
 
@Kratus I found out the problem on why the current background doesn't transition after choosing one same part. But I don't know what the solution is. For example, when you select "Italy" to transition to the "Italy" background, you can choose any different background in the new menu after selecting it. But when it comes to the second time to select the same one ("Italy") after choosing the current one ("Italy"), you cannot transition from one background to another anymore. How can I get this to work if I choose the same one the second time or so without it being stuck to the current background?

Anyway, here's my new update.c.
C:
#import "data/scripts/spawn004.c"

void main()
{
    //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }
    //CHECK IF THE PLAYER IS IN A LEVEL
    if(openborvariant("in_level") && openborvariant("current_set") < 4){
        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 4;
        int min            = 0;
        int add            = 1;
        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        //if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newMenu") == NULL()){
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newSelectMusic") == NULL()){
            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
                
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
                
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }
            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
                
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);
                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }
                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    setglobalvar("menuPause", 0);
                    playgif("data/scenes/howto.gif");
                }
                //NEW MENU FLAG
                if(menuPause == 3){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("newMenu", 1);
                    setglobalvar("newSelectMusic", 1);
                }
                //END GAME
                if(menuPause == 4){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
            }
            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int font4        = 0;
            int yAdd        = 11;
            int layer        = -1000000003;
            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS HOW TO PLAY HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}else    //IS NEW MENU HIGHLIGHTED??
            if(getglobalvar("menuPause") == 4){font4 = 1;}        //IS END GAME HIGHLIGHTED??
            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);
            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);
            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);
            yPos = yPos+yAdd;
            str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);
            yPos = yPos+yAdd;
            str = "New Menu";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);
            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font4)))/2;
            drawstring(align, yPos, font4, str, layer);
        }
        //DEFINE CONDITIONS TO ACTIVATE THE NEW MENU
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newSelectMusic") != NULL()){
            newSelectMusic();
        }
        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }
        //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){
            //END GAME
            if(menuPause == 4){gameover();}
        }
        
    }
}

void newSelectMusic(){
    int volume        = openborvariant("effectvol");
    int speed        = 100;
    int loop        = 0;
    int menuSong    = getglobalvar("menuSong");
    int max            = 2;
    int min            = 0;
    int add            = 1;
    void vSpawn; void vSpawn2;
    clearspawnentry();
    loadmodel("Bakraun1");
    setspawnentry("name", "Bakraun1");
    clearspawnentry();
    loadmodel("Bakraun2");
    setspawnentry("name", "Bakraun2");
    if(menuSong == NULL()){
        setglobalvar("menuSong", 0);
    }
    if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newSelectMusic") == 1){
        if( playerkeys(0, 1, "movedown") ||
            playerkeys(1, 1, "movedown") ||
            playerkeys(2, 1, "movedown") ||
            playerkeys(3, 1, "movedown") ){
            if(menuSong >= min && menuSong < max){setglobalvar("menuSong", menuSong+add);}
            if(menuSong == max){setglobalvar("menuSong", min);}
        }
        if( playerkeys(0, 1, "moveup") ||
            playerkeys(1, 1, "moveup") ||
            playerkeys(2, 1, "moveup") ||
            playerkeys(3, 1, "moveup") ){
            if(menuSong > min && menuSong <= max){setglobalvar("menuSong", menuSong-add);}
            if(menuSong == min){setglobalvar("menuSong", max);}
        }
        if( playerkeys(0, 1, "anybutton") ||
            playerkeys(1, 1, "anybutton") ||
            playerkeys(2, 1, "anybutton") ||
            playerkeys(3, 1, "anybutton") ){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
            setglobalvar("newSelectMusic", NULL());
            setglobalvar("menuPause", 0);
            if(menuSong == 0){
                changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                //fademusic(0.5, "data/music/dojo2/miami.bor", 1, 628476.81);
                //setglobalvar("menuPause", 0);
                vSpawn = spawn004("Bakraun1", "Bakraun1", 0, 10, 0, 163, 0, 3, openborconstant("ANI_IDLE"), 0); // Beach's fade-in
                if(getentityproperty(vSpawn2, "animationid") == openborconstant("ANI_IDLE") && getentityproperty(vSpawn2, "animpos") == 10 || getentityproperty(vSpawn2, "animpos") == 11){ // Italy's fade-in
                    changeentityproperty(vSpawn2, "animation", openborconstant("ANI_FOLLOW1")); // Italy's fade-out
                }
            }
            if(menuSong == 1){
                changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                //fademusic(0.5, "data/music/dojo2/italy.bor", 1, 372394.78);
                //setglobalvar("menuPause", 0);
                vSpawn2 = spawn004("Bakraun2", "Bakraun2", 0, 10, 0, 163, 0, 3, openborconstant("ANI_IDLE"), 0);
                if(getentityproperty(vSpawn, "animationid") == openborconstant("ANI_IDLE") && getentityproperty(vSpawn, "animpos") == 10 || getentityproperty(vSpawn, "animpos") == 11){
                    changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW1"));
                }
            }
            if(menuSong == 2){
                changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                //fademusic(0.5, "data/music/remix.bor", 1, 1);
                //setglobalvar("menuPause", 0);
                //changeentityproperty(vSpawn2, "animation", openborconstant("ANI_FOLLOW1"));
                //changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW1"));
                if(getentityproperty(vSpawn2, "animationid") == openborconstant("ANI_IDLE") && getentityproperty(vSpawn2, "animpos") == 10 || getentityproperty(vSpawn2, "animpos") == 11){ // Italy's fade-in
                    changeentityproperty(vSpawn2, "animation", openborconstant("ANI_FOLLOW1")); // Italy's fade-out
                }
                if(getentityproperty(vSpawn, "animationid") == openborconstant("ANI_IDLE") && getentityproperty(vSpawn, "animpos") == 10 || getentityproperty(vSpawn, "animpos") == 11){
                    changeentityproperty(vSpawn, "animation", openborconstant("ANI_FOLLOW1"));
                }
            }
        }
        
        void str;
        float hRes        = openborvariant("hresolution");
        int align;
        int yPos        = 50;
        int fontPause    = 3;
        int font0        = 0;
        int font1        = 0;
        int font2        = 0;
        int yAdd        = 11;
        int layer        = -1000000003;
            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
        if(getglobalvar("menuSong") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
        if(getglobalvar("menuSong") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
        if(getglobalvar("menuSong") == 2){font2 = 1;}
        str = "Select Song";align = (hRes-(strwidth(str, fontPause)))/2;
        drawstring(align, yPos, fontPause, str, layer);
        yPos = yPos+yAdd*3;
        str = "Miami";align = (hRes-(strwidth(str, font0)))/2;
        drawstring(align, yPos, font0, str, layer);
        yPos = yPos+yAdd;
        str = "Italy";align = (hRes-(strwidth(str, font1)))/2;
        drawstring(align, yPos, font1, str, layer);
        yPos = yPos+yAdd;
        str = "Normal";align = (hRes-(strwidth(str, font2)))/2;
        drawstring(align, yPos, font2, str, layer);
    
    }
}
 
I have a strange feeling about (un)loading models as level transitions and @DCurrent was right about using layers as transitions or something instead of models. What I want to do is to draw a sprite and place it to the very top left of the level as a background, starting from the level width of 0. Also, I wanna have a sprite animated like @Bloodbane's animated title screen demo where a sprite is animated, which you find out it has 8 separate sprites that are made for the title screen. But with this, I need to make transparent with drawmethod in script. setdrawmethod would be a good choice, I think. But I don't know how it's gonna work when it comes to the animation-like effect. I've seen setdrawmethod is used with "rotate" being rotated around in a 360-degree motion from the Rocket Viper game. But I found out it's for entities/models.

Example:
C:
name        FootBall
health        0
score        200
type        item
gfxshadow    1
candamage    player npc enemy
offscreenkill    100
didhitscript    data\chars\misc\football\football.c
anim    idle
    @script
        void self=getlocalvar("self");
        void ro=getscriptvar(0);
        void xdir=getentityproperty(self,"xdir");
        if(ro==NULL())ro=0;
        if(xdir>0)
        {
            xdir-=0.05;
            if(xdir<0)xdir=0;
            ro+=xdir*20;
        }else{
            xdir+=0.05;
            if(xdir>0)xdir=0;
            ro-=xdir*70;
        }
        ro%=360;
        setscriptvar(0,ro);
        setdrawmethod(self,1,256,256,0,0,0,0,0,0,ro);
        changeentityproperty(getlocalvar("self"),"velocity",xdir);
    @end_script
    loop    1
    Delay    4
    OffSet    9 9
    hitfx    data/sounds/empty.wav
    Attack    3 0 16 19 0 1 1 1
    dropv    1 1
    BBox    2 1 16 18
    Frame    data\chars\misc\football\idle00.gif
    Attack    0
    Frame    data\chars\misc\football\idle00.gif

C:
void main()
{
    void target = getlocalvar("damagetaker");
    void dir=getentityproperty(target,"direction");
    void xsp;
    if(dir)
        xsp=1;
    else
        xsp=-1;
    changeentityproperty(getlocalvar("self"),"velocity",xsp);
}

I don't know about scriptvar but I hear it's now a wrap as localvar or entityvar.

I want to make a drawn sprite transparent like an animation as a layer, not as a model. How can I get a sprite to be transparent in script without relying on models?
 
I have a question regarding selecting the same option again from the new menu after selecting it. The first time I'm in the game, I select the first song from the new menu and have the original background to transition to another one covering it. For instance, you select the Beach option from the new menu for the first time and that background appears. Then, you pause again and choose the new menu option again. You pick that same Beach option the second time. What I want to know is about how many times you select that same option after the first time you pick that in the game. Plus, I'm thinking of adding a warning text as a message asking you if you want to continue to select that same option with options yes and no. If you answer yes, you'll receive a message saying "Sorry. Choose a different background," and be forced to go back to the options of which option to choose other than that same option you selected previously. You won't select that same/previous option unless you select a different one. If you select a different one, you can always go back to select the Beach option. If you select no, you'll just go back to the options in the new menu.

I already updated background's animations into 4 for transitioning stages. One anim for appearing (anim spawn) as fade-in, one anim for skipping to loop (anim idle), one for looping (anim follow2), and one for dissapearing (anim follow1) as fade-out.

Code:
anim idle #Stay idle
     loop      0
     delay     2
     offset    10 163
     @cmd changeopenborvariant "nopause" 0
     frame     data/bgs/dojo2/beach.png #0
     @cmd performattack getlocalvar("self") openborconstant("ANI_FOLLOW2")
     frame     data/bgs/dojo2/beach.png #0

Code:
anim follow2 #Stay idle
     delay     5
     offset    10 163
     loop    1
     @cmd changeopenborvariant "nopause" 0
     frame     data/bgs/dojo2/beach.png
     frame     data/bgs/dojo2/beach.png
     frame     data/bgs/dojo2/beach.png
     frame     data/bgs/dojo2/beach.png

Here: (The Beach skin already displays.)

Pause...

Continue
Options
How to Play
=> New Menu
Quit Game

Select Song
=> Beach
Italy
Normal

Select Beach option the second time when there's already Beach background covering the normal stage. But I don't know how to execute it into a new command/execution after that. How can I display an example of showing a warning message when you select it the second time?
 
I updated the pause menu template with a new menu example.

C:
void main()
{
    //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }

    //CHECK IF THE PLAYER IS IN A LEVEL
    if(openborvariant("in_level")){
        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 4;
        int min            = 0;
        int add            = 1;

        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newMenu") == NULL()){

            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
               
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
               
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }

            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
               
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);

                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }

                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }

                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    setglobalvar("menuPause", 0);
                    playgif("data/scenes/howto.gif");
                }

                //NEW MENU FLAG
                if(menuPause == 3){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    setglobalvar("newMenu", 1);
                }

                //END GAME
                if(menuPause == 4){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
            }

            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int font4        = 0;
            int yAdd        = 11;
            int layer        = -1000000003;

            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS HOW TO PLAY HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}else    //IS NEW MENU HIGHLIGHTED??
            if(getglobalvar("menuPause") == 4){font4 = 1;}        //IS END GAME HIGHLIGHTED??

            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);

            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);

            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);

            yPos = yPos+yAdd;
            str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);

            yPos = yPos+yAdd;
            str = "New Menu";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);

            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font4)))/2;
            drawstring(align, yPos, font4, str, layer);
        }

        //DEFINE CONDITIONS TO ACTIVATE THE NEW MENU
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newMenu") != NULL()){
            newMenu();
        }

        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }

        //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){

            //END GAME
            if(menuPause == 4){gameover();}
        }

       
    }
}

void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    drawstring(50, 50, 0, "New Menu");
    drawstring(50, 60, 0, "Press any key to back");

    if(    playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||
        playerkeys(2, 1, "anybutton")||
        playerkeys(3, 1, "anybutton")||
        playerkeys(0, 1, "esc")|| //DETECT ESC KEY PRESS
        playerkeys(1, 1, "esc")||
        playerkeys(2, 1, "esc")||
        playerkeys(3, 1, "esc")){
       
        //DISABLE THE NEW MENU IF ANY ACTION KEY IS PRESSED
        setglobalvar("newMenu", NULL());

        //DISABLE ANY ACTION KEY NATIVE EFFECT
        changeplayerproperty(0, "newkeys", 0);
        changeplayerproperty(1, "newkeys", 0);
        changeplayerproperty(2, "newkeys", 0);
        changeplayerproperty(3, "newkeys", 0);
    }
}

Hi, Kratus. I started to use this again for replacing drawstring with playgif as a test. But somehow, unlike drawstring, which allows you to press any button or escape to go back to the pause menu, pressing any button reverts back to play its how-to gif animation every time unless you press an escape button to go back. Like this, right here.

Code:
void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    playgif("data/scenes/intro/howto.gif");

    if(    playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||

Even this from the pause menu itself.
Code:
                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("menuPause", 0);
                    //playgif("data/scenes/howto.gif");
                    setglobalvar("newMenu", 1);
                }
 
Hi, Kratus. I started to use this again for replacing drawstring with playgif as a test. But somehow, unlike drawstring, which allows you to press any button or escape to go back to the pause menu, pressing any button reverts back to play its how-to gif animation every time unless you press an escape button to go back. Like this, right here.

Code:
void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    playgif("data/scenes/intro/howto.gif");

    if(    playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||

Even this from the pause menu itself.
Code:
                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("menuPause", 0);
                    //playgif("data/scenes/howto.gif");
                    setglobalvar("newMenu", 1);
                }
I don't know if I understood correctly how your code works, but it seems that there's a playgif running freely in the update.c script without any variable/button requirement.

1727318540835.png
 
Lemme show you the video along with the code.


C:
void main(){
    defaultPause();
}

void defaultPause()
{
    //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }

    //CHECK IF THE PLAYER IS IN A LEVEL
    if(openborvariant("in_level")){
        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 3;
        int min            = 0;
        int add            = 1;

        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        if(openborvariant("game_paused") && !openborvariant("in_options")){

            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
                
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
                
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }

            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
                
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);

                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }

                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }

                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("menuPause", 0);
                    //playgif("data/scenes/howto.gif");
                    setglobalvar("newMenu", 1);
                }

                //END GAME
                if(menuPause == 3){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
            }

            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int yAdd        = 11;
            int layer        = -1000000003;

            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS HOW TO PLAY HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}        //IS END GAME HIGHLIGHTED??

            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);

            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);

            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);

            yPos = yPos+yAdd;
            str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);

            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);
        }

        //DEFINE CONDITIONS TO ACTIVATE THE NEW MENU
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newMenu") != NULL()){
            newMenu();
        }

        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }
        

        //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){

            //END GAME
            if(menuPause == 3){gameover();}
        }
    }
}

void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    playgif("data/scenes/intro/howto.gif");

    if(    playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||
        playerkeys(2, 1, "anybutton")||
        playerkeys(3, 1, "anybutton")||
        playerkeys(0, 1, "esc")|| //DETECT ESC KEY PRESS
        playerkeys(1, 1, "esc")||
        playerkeys(2, 1, "esc")||
        playerkeys(3, 1, "esc")){
        
        //DISABLE THE NEW MENU IF ANY ACTION KEY IS PRESSED
        setglobalvar("newMenu", NULL());
    setglobalvar("menuPause", 2);

        //DISABLE ANY ACTION KEY NATIVE EFFECT
        changeplayerproperty(0, "newkeys", 0);
        changeplayerproperty(1, "newkeys", 0);
        changeplayerproperty(2, "newkeys", 0);
        changeplayerproperty(3, "newkeys", 0);
    }
}
 
Lemme show you the video along with the code.


C:
void main(){
    defaultPause();
}

void defaultPause()
{
    //NECESSARY STEP TO RESET THE "MENU OPTION" VARIABLE AT THE TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        if(getglobalvar("menuPause") != 0){setglobalvar("menuPause", 0);}
    }

    //CHECK IF THE PLAYER IS IN A LEVEL
    if(openborvariant("in_level")){
        int volume        = openborvariant("effectvol");
        int speed        = 100;
        int loop        = 0;
        int menuPause    = getglobalvar("menuPause");
        int max            = 3;
        int min            = 0;
        int add            = 1;

        //CHECK IF THE GAME IS PAUSED BUT NOT IN OPTIONS
        if(openborvariant("game_paused") && !openborvariant("in_options")){

            //DETECT UP/DOWN BUTTON PRESS AND CHANGE THE HIGHLIGHTED OPTION
            if(    playerkeys(0, 1, "movedown")||
                playerkeys(1, 1, "movedown")||
                playerkeys(2, 1, "movedown")||
                playerkeys(3, 1, "movedown")){
               
                if(menuPause >= min && menuPause < max){setglobalvar("menuPause", menuPause+add);}
                if(menuPause == max){setglobalvar("menuPause", min);}
            }
            if(    playerkeys(0, 1, "moveup")||
                playerkeys(1, 1, "moveup")||
                playerkeys(2, 1, "moveup")||
                playerkeys(3, 1, "moveup")){
               
                if(menuPause > min && menuPause <= max){setglobalvar("menuPause", menuPause-add);}
                if(menuPause == min){setglobalvar("menuPause", max);}
            }

            //DEFINE A FUNCTION TO BE EXECUTED WHEN EACH OPTION IS CONFIRMED BY PRESSING ACTION KEYS
            //NOTE THAT SOME OPTIONS ALREADY PLAY SAMPLES NATIVELY, ONLY A FEW NEED TO BE MANUALLY PLAYED
            if(    playerkeys(0, 1, "anybutton")||
                playerkeys(1, 1, "anybutton")||
                playerkeys(2, 1, "anybutton")||
                playerkeys(3, 1, "anybutton")){
               
                //LOCK NATIVE KEYS
                changeplayerproperty(0, "newkeys", 0);
                changeplayerproperty(1, "newkeys", 0);
                changeplayerproperty(2, "newkeys", 0);
                changeplayerproperty(3, "newkeys", 0);

                //CONTINUE
                if(menuPause == 0){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }

                //OPTIONS
                if(menuPause == 1){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    options();
                }

                //HOW TO PLAY
                if(menuPause == 2){
                    playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
                    //setglobalvar("menuPause", 0);
                    //playgif("data/scenes/howto.gif");
                    setglobalvar("newMenu", 1);
                }

                //END GAME
                if(menuPause == 3){
                    changeplayerproperty(0, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(1, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(2, "newkeys", openborconstant("FLAG_ESC"));
                    changeplayerproperty(3, "newkeys", openborconstant("FLAG_ESC"));
                }
            }

            //TEXTS, IMAGES AND EFFECTS
            void str;
            float hRes        = openborvariant("hresolution");
            int align;
            int yPos        = 80;
            int fontPause    = 3;
            int font0        = 0;
            int font1        = 0;
            int font2        = 0;
            int font3        = 0;
            int yAdd        = 11;
            int layer        = -1000000003;

            //DEFINE FONTS TO HIGHLIGHTED OPTIONS
            if(getglobalvar("menuPause") == 0){font0 = 1;}else    //IS CONTINUE HIGHLIGHTED??
            if(getglobalvar("menuPause") == 1){font1 = 1;}else    //IS OPTIONS HIGHLIGHTED??
            if(getglobalvar("menuPause") == 2){font2 = 1;}else    //IS HOW TO PLAY HIGHLIGHTED??
            if(getglobalvar("menuPause") == 3){font3 = 1;}        //IS END GAME HIGHLIGHTED??

            str = "Pause";align = (hRes-(strwidth(str, fontPause)))/2;
            drawstring(align, yPos, fontPause, str, layer);

            yPos = yPos+yAdd*3;
            str = "Continue";align = (hRes-(strwidth(str, font0)))/2;
            drawstring(align, yPos, font0, str, layer);

            yPos = yPos+yAdd;
            str = "Options";align = (hRes-(strwidth(str, font1)))/2;
            drawstring(align, yPos, font1, str, layer);

            yPos = yPos+yAdd;
            str = "How To Play";align = (hRes-(strwidth(str, font2)))/2;
            drawstring(align, yPos, font2, str, layer);

            yPos = yPos+yAdd;
            str = "End Game";align = (hRes-(strwidth(str, font3)))/2;
            drawstring(align, yPos, font3, str, layer);
        }

        //DEFINE CONDITIONS TO ACTIVATE THE NEW MENU
        if(openborvariant("game_paused") && !openborvariant("in_options") && getglobalvar("newMenu") != NULL()){
            newMenu();
        }

        //LOCK ACTION KEYS, NECESSARY STEP TO QUIT FROM THE OPTIONS IGNORING THE NATIVE "END GAME" OPTION
        if(openborvariant("game_paused") && openborvariant("in_options")){
            changeplayerproperty(0, "newkeys", 0);
            changeplayerproperty(1, "newkeys", 0);
            changeplayerproperty(2, "newkeys", 0);
            changeplayerproperty(3, "newkeys", 0);
        }
       

        //NECESSARY STEPS THAT NEED TO RUN AFTER SOME OPTIONS LIKE "END GAME" ARE CONFIRMED
        //THERE'S A FEW ENGINE FUNCTIONS THAT ONLY RUN OUTSIDE OF THE PAUSE MENU
        if(!openborvariant("game_paused") && !openborvariant("in_options")){

            //END GAME
            if(menuPause == 3){gameover();}
        }
    }
}

void newMenu()
{
    //DRAW CONTENT ON THE SCREEN
    playgif("data/scenes/intro/howto.gif");

    if(    playerkeys(0, 1, "anybutton")|| //DETECT ANY ACTION KEY PRESS
        playerkeys(1, 1, "anybutton")||
        playerkeys(2, 1, "anybutton")||
        playerkeys(3, 1, "anybutton")||
        playerkeys(0, 1, "esc")|| //DETECT ESC KEY PRESS
        playerkeys(1, 1, "esc")||
        playerkeys(2, 1, "esc")||
        playerkeys(3, 1, "esc")){
       
        //DISABLE THE NEW MENU IF ANY ACTION KEY IS PRESSED
        setglobalvar("newMenu", NULL());
    setglobalvar("menuPause", 2);

        //DISABLE ANY ACTION KEY NATIVE EFFECT
        changeplayerproperty(0, "newkeys", 0);
        changeplayerproperty(1, "newkeys", 0);
        changeplayerproperty(2, "newkeys", 0);
        changeplayerproperty(3, "newkeys", 0);
    }
}
It seems that you are in a infinite loop. In the newMenu() code (green box) if any button is pressed, the "newMenu" variable resets to NULL() but the "menuPause" (red box) is set to 2, then if the menuPause is 2 the "newMenu" variable is automatically set to 1 again.

1727408068422.png

1727408667243.png

In my original code the playgif works directly in the menuPause 2 without any additional menu. In addition, the menuPause variable is instanly set to 0 in order to break the infinite loop.
In short, if you are quitting from the "menuPause 2", you must change the variable to other value different than 2, otherwise you will have a infinite loop.

Code:
//HOW TO PLAY
if(menuPause == 2){
    playsample(openborvariant("global_sample_beep_2"), 0, volume, volume, speed, loop);
    //playsample(openborconstant("SAMPLE_BEEP2"), 0, volume, volume, speed, loop);
    setglobalvar("menuPause", 0);
    playgif("data/scenes/howto.gif");
}
 
Back
Top Bottom