SOLVED Score screen can be controlled?

Toranks

Active member
Is there a way to pause at each subtotal and total pushing any button, instead of closing the screen entirely?
If I don't press any button, punctuation is added at a constant speed. Can I change that speed?
Thanks!
 
Looking from the top of my head, yes.
There is a openborvariant called "in_showcomplete", which is triggered when this screen appears.

You would need to interrupt the button presses while you are on this screen. I never did it myself, but maybe Kratus can help you since he made a custom menu and those button presses can work on the same way he did.
 
O Ilusionista said:
Looking from the top of my head, yes.
There is a openborvariant called "in_showcomplete", which is triggered when this screen appears.

You would need to interrupt the button presses while you are on this screen. I never did it myself, but maybe Kratus can help you since he made a custom menu and those button presses can work on the same way he did.

Yes, O Ilusionista is right, you can use "in_showcomplete" for that. I made a quick test and I can't found a way to pause score at each subtotal, but I found a way to slow the score speed. You can use the openborvariant "slowmotion" for that in keyall.c and change speed using left or right directional buttons. I'm using the value "2", but you can use any other as you wish:
Code:
void main()
{//Global keyall scripts, detects player index
	void player = getlocalvar("player");
	
	if(openborvariant("in_showcomplete")){
		if(playerkeys(player, 1, "moveleft")){
			changeopenborvariant("slowmotion", 2); //SLOW SPEED
		}
		if(playerkeys(player, 1, "moveright")){
			changeopenborvariant("slowmotion", 0); //NORMAL SPEED
		}
	}
}

If you want to disable attack key at complete screen, I suggest to use "disablekey" function:
Code:
void main()
{//GLOBAL OPERATIONS
	if(openborvariant("in_showcomplete")){
		changeplayerproperty(0, "disablekeys", openborconstant("FLAG_ATTACK")); //DISABLE KEY FOR PLAYER 1
		changeplayerproperty(1, "disablekeys", openborconstant("FLAG_ATTACK")); //DISABLE KEY FOR PLAYER 2
		changeplayerproperty(2, "disablekeys", openborconstant("FLAG_ATTACK")); //DISABLE KEY FOR PLAYER 3
		changeplayerproperty(3, "disablekeys", openborconstant("FLAG_ATTACK")); //DISABLE KEY FOR PLAYER 4
	}
}

If you want to disable multiple keys, you can use this:
Code:
changeplayerproperty(0, "disablekeys", openborconstant("FLAG_ATTACK")+openborconstant("FLAG_ATTACK2")+openborconstant("FLAG_ATTACK3")+openborconstant("FLAG_ATTACK4")+openborconstant("FLAG_JUMP")+openborconstant("FLAG_SPECIAL")+openborconstant("FLAG_START"));

You can disable keys in the file endlevel.c and then re-enable in the file level.c. Remember that this funciont will re-enable all disabled keys at the same time:
Code:
changeplayerproperty(0, "disablekeys", 0);
changeplayerproperty(1, "disablekeys", 0);
changeplayerproperty(2, "disablekeys", 0);
changeplayerproperty(3, "disablekeys", 0);

You can also use the file updated.c to disable and re-enable keys in the same script detecting openborvariants like "in_level" and "in_showcomplete".
 
Toranks said:
Thanks!
Can this method be used to speed up animation? In my case what I would like is to increase the speed in which the points are added
Toranks, I made more tests and I found a way to increase score speed. Is a bizarre way but works lol
All you need is to add this script in the file updated.c:
Code:
if(openborvariant("in_showcomplete")){ //IS IN COMPLETE SCREEN??
		
		//INCREASE SPEED
		if(playerkeys(0, 0, "movedown")){ //P1 HOLD BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+1000);
		}
		else
		if(playerkeys(1, 0, "movedown")){ //P2 HOLD BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+1000);
		}
		
		//GO TO TOTAL SCORE WITHOUT CLOSE THE COMPLETE SCREEN
		if(playerkeys(0, 1, "moveup")){ //P1 PRESS BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+10000000);
		}
		else
		if(playerkeys(1, 1, "moveup")){ //P2 PRESS BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+10000000);
		}
	}
NOTE 1: You can use any value in "changeopenborvariant" line to modify time speed

NOTE 2: In this example I'm using "up" and "down" directions but you can change it to any button. However, if you use action buttons (attack, special, etc) it will close the complete screen, maybe is better to disable these keys with the script that I sent before

NOTE 3: If you purpose is to see total score without close the complete screen, now you can do it

NOTE 4: I don't know if this method affects somethings when the new level starts, I suggest to make some tests

Thanks for the idea, I will apply it on SOR2X too.
 
Thanks! This works for me, it is exactly what I was looking for :D
I only have one problem left to solve. Can I disable the attack button and use it to accelerate, instead of directions? It would be more intuitive. Without a manual, people may not know how to advance.

I'm using this code and it works fine. This lets skip the screen by pressing start, but not another button. This is for a 3 players game.

Code:
void main(){
	void lv1 = getplayerproperty(0, "lives");
	void lv2 = getplayerproperty(1, "lives");
	void lv3 = getplayerproperty(2, "lives");	
	resetMaxRush();
	score();
etc etc etc....

void score()
{//GLOBAL OPERATIONS
	if(openborvariant("in_showcomplete")){
		changeplayerproperty(0, "disablekeys", openborconstant("FLAG_ATTACK")+openborconstant("FLAG_ATTACK2")+openborconstant("FLAG_ATTACK3")+openborconstant("FLAG_ATTACK4")+openborconstant("FLAG_JUMP")+openborconstant("FLAG_SPECIAL")); //DISABLE KEY FOR PLAYER 1		
		changeplayerproperty(1, "disablekeys", openborconstant("FLAG_ATTACK")+openborconstant("FLAG_ATTACK2")+openborconstant("FLAG_ATTACK3")+openborconstant("FLAG_ATTACK4")+openborconstant("FLAG_JUMP")+openborconstant("FLAG_SPECIAL")); //DISABLE KEY FOR PLAYER 2
		changeplayerproperty(2, "disablekeys", openborconstant("FLAG_ATTACK")+openborconstant("FLAG_ATTACK2")+openborconstant("FLAG_ATTACK3")+openborconstant("FLAG_ATTACK4")+openborconstant("FLAG_JUMP")+openborconstant("FLAG_SPECIAL")); //DISABLE KEY FOR PLAYER 3
		
		//INCREASE SPEED
		if(playerkeys(0, 0, "moveup")){ //P1 HOLD BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+100);
		}
		else
		if(playerkeys(1, 0, "moveup")){ //P2 HOLD BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+100);
		}
		else
		if(playerkeys(2, 0, "moveup")){ //P3 HOLD BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+100);
		}
		
		//GO TO TOTAL SCORE WITHOUT CLOSE THE COMPLETE SCREEN
		if(playerkeys(0, 1, "movedown")){ //P1 PRESS BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+1000);
		}
		else
		if(playerkeys(1, 1, "movedown")){ //P2 PRESS BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+1000);
		}
		else
		if(playerkeys(2, 1, "movedown")){ //P3 PRESS BUTTON
			changeopenborvariant("elapsed_time", openborvariant("elapsed_time")+1000);
		}
	}
}
 
Toranks said:
Thanks! This works for me, it is exactly what I was looking for :D
I only have one problem left to solve. Can't I disable the attack button and use it to accelerate, instead of directions? It would be more intuitive. Without a manual, people may not know how to advance.

I'm using this code and it works fine. This lets skip the screen by pressing start, but not another button. This is for a 3 players game.

I forgot to say, if you want to disable all action keys at the same time, use "FLAG_ANYBUTTON" only instead to write all buttons. But in your case, to avoid the start button, needs to define one by one like you already made.

I disabled all action buttons and tried to use attack button to increase score speed but unfortunately it not worked. If I discover another way, I will share with you.
 
If you find tell me, please. Anyway I solve the thread, because I already have exactly what I was looking for, and with the start button you can skip the screen as before, which is still intuitive.
Thank you!
 
O Ilusionista said:
Kratus hahahahah changing elapsedtime was very smart :)
But doesn't this affects other things? AFAIK, elapsedtime is a number which constantly increases since you run the engine until you shut it down.

hahaha thanks O Ilusionista
I don't know if it affects other things, apparently hasn't affected anything yet but I'm monitoring.

Maybe Damon Caskey can answer this question for us. I'm not sure, but maybe it can affect only the scripts that run during "complete screen" and are using "elapsed time" variant at the same time. In SOR2X for example, during "complete screen" there are no scripts using "elapsed time" variant except for this one that change score speed. But it can be a problem if more scripts are using this variant together
 
Damon Caskey said:
Elapsed time resets when a level starts. There's no global timer, so if you need one you'll need to script it.

DC

Thanks DC. If I understand correctly, I can change elapsed time variant during complete screen with no problems for the new level. Good ;)
 
This solution has an unexpected bug. With @Kratos script, the score added does not increases lives counter correctly, it simply ignores the score number and starts again on the next screen. What can be the cause?
 
Toranks said:
This solution has an unexpected bug. With @Kratos script, the score added does not increases lives counter correctly, it simply ignores the score number and starts again on the next screen. What can be the cause?
Toranks
Yeah, I tested and really this problem happens, but for some strange reason I discovered that the lives not changed even if no key is held or pressed, maybe some bug with Lifescore in models.txt.

I'm making more tests to find a solution
 
Kratus said:
Yeah, I tested and really this problem happens, but for some strange reason I discovered that the lives not changed even if no key is held or pressed, maybe some bug with Lifescore in models.txt.

I'm making more tests to find a solution

Thanks!  I will be pending
 
Toranks said:
Kratus said:
Yeah, I tested and really this problem happens, but for some strange reason I discovered that the lives not changed even if no key is held or pressed, maybe some bug with Lifescore in models.txt.

I'm making more tests to find a solution

Thanks!  I will be pending
After many tests, I can say that this is a random issue but is not related to any script. I tested in many builds from 4432 to 6330, tested other mods, deactivated most of the scripts but no success.

However I discovered one thing, the "lives counter" will always be added correctly if the player presses any attack button at the complete screen and it instantly closes. If the player lets the counter run alone, sometimes the live is added, sometimes not, and the same occurs with the script that changes the "elapsed_time" variant.

I'm making more tests to find a way to avoid it because it can break the gameplay. I'm checking at the source code to see what happens when any player presses a button because this is the only event where the counter works fine. I never saw it because I always press attack buttons when I'm on the complete screen.

If no success, unfortunately I will make a scripted "lifescore" and set the native engine function with any bigger value like 99999999 to remain deactivated.

Here's a video showing a small test using "Lifescore" to add +1 live at each 100.000. I changed the "stagebonus" in levels.txt to 500.000 and started the game with 3 lives.
After beating the boss, 500.000 points = 5 lives, that makes a total of 8 lives at the next stage.

In the first test I pressed no button until it reached 100k, and then I pressed and held directional buttons to accelerate the counter, but no live is added.

In the second test I pressed the attack button once and all lives were added normally, as you can see in the video.
https://www.youtube.com/watch?v=iHCdLh4EH5U
 
Toranks said:
Perhaps it can be solved by simulating attack button pressing at the end of the scoring screen via script?
Hi Toranks
As I promissed, I found a way to avoid this issue by simulating the same "lifescore" native engine function with script.
This was possible thanks to the source code that gave me some lights. Basically you need to create a global event file called "score1.c", that is used by player 1 when your score make any change (score2.c for player 2 and so on...). Simply put this file in the folder "data/scripts" and copy the following code:

Code:
void main()
{
	lifeScore(0);
}

void lifeScore(int player)
{//Custom LifeScore script for add lives, used to avoid native engine LifeScore issue
	void self	  = getplayerproperty(player, "entity");
	int score	  = getplayerproperty(player, "score");
	int lifeScore     = 100000; //DEFINED LIFESCORE TARGET TO ADD EACH LIVE
	int add		  = 1; //HOW MUCH LIVES WILL BE ADDED WHEN SCORE REACHED THE TARGET
	
	//USED TO CHECK IF THE PLAYER IS IN A NEW GAME
	if(getglobalvar("next1up"+player) == NULL()){
		setglobalvar("next1up"+player, lifeScore);
	}
	
	//USED TO ADD LIVES TO PLAYER
	if(self != NULL()){ //CURRENT PLAYER REMAINS IN GAME??
		while(score >= getglobalvar("next1up"+player)){ //CURRENT SCORE REACHED THE LAST DEFINED TARGET??
			int lives = getplayerproperty(player, "lives"); //CHECK CURRENT LIVES EVERYTIME THIS TASK RUNS
			playsample(openborconstant("SAMPLE_1UP"), 0, 120, 120, 100, 0); //PLAY SAMPLE
			changeplayerproperty(player, "lives", lives+add); //ADD +1 LIVE
			setglobalvar("next1up"+player, getglobalvar("next1up"+player)+lifeScore); //DEFINE AND SAVE THE NEXT TARGET
		}
	}
}

NOTE 1: In the void "main function", don't forget to change the player index if you are using this same script for other players. For example, for player 2 you will need to change "lifeScore(0)" to lifeScore(1), and so on for players 3 and 4.

NOTE 2: Don't forget to disable native engine lifescore function by changing it to a high number like 9999999999

NOTE 3: You can change both "lifeScore" and "add" to any value you want

Please let me know if worked. Here a small video showing this script working.
https://www.youtube.com/watch?v=B89fv0nOmFU
Same as the previous video, in the first test no key was pressed until 100k and +1 live was added, and the same happens when holding directional buttons to accelerate the variant "elapsed_time", +1 live is added every 100k correctly.

In the second test, all lives were added correctly using attack button to end the complete screen, you can see it when the stage 2 starts.

One more thing, I'm using globalvar because I need to get some info for other scripts but it works using localvars too. And don't forget to clear both localvar or globalvar at some point before a new game starts. In my case I'm clearing at the title screen but it is up to you.

nsw25
Thanks for the suggestion, I will make it to add more info to the GitHub. Really I agree that it can be tied with the same issue as yours.
In my case I need a scripted version because have no intention to change my OpenBOR build for now, due to a lot of tests made with the build 6330.
 
Kratus said:
Hi Toranks
As I promissed, I found a way to avoid this issue by simulating the same "lifescore" native engine function with script.
This was possible thanks to the source code that gave me some lights. Basically you need to create a global event file called "score1.c", that is used by player 1 when your score make any change (score2.c for player 2 and so on...). Simply put this file in the folder "data/scripts" and copy the following code:

It works!

On the last minute of this video you can see the complete code in action. A controlled score screen, 2 lives added (1 every 250.000), and a new globalvar on save file:
Code:
setglobalvar("next1up0",7250000);
So, this is save-compatible. I delete all globalvars on main screen with another script, just in case.

I will add it to the game update, a lot of thanks!!
 
Toranks said:
Kratus said:
Hi Toranks
As I promissed, I found a way to avoid this issue by simulating the same "lifescore" native engine function with script.
This was possible thanks to the source code that gave me some lights. Basically you need to create a global event file called "score1.c", that is used by player 1 when your score make any change (score2.c for player 2 and so on...). Simply put this file in the folder "data/scripts" and copy the following code:

It works!

On the last minute of this video you can see the complete code in action. A controlled score screen, 2 lives added (1 every 250.000), and a new globalvar on save file:
Code:
setglobalvar("next1up0",7250000);
So, this is save-compatible. I delete all globalvars on main screen with another script, just in case.

I will add it to the game update, a lot of thanks!!
Great! I'm glad it worked
And I need to thank you for discovering this issue, updated my game too
 
Back
Top Bottom