Solved Integer Text Score Increase

Question that is answered or resolved.

maxman

Well-known member
I'm trying to make score integer go high with a decimal by going to its left like you see below. That score 0 should stay where it is while it increases from player's attacks.

score_example.gif


But I have a problem with a text in x in drawstring. I put it in the middle to test player's score. Every time player attacks, the score moves left little by little. I'm trying to retain that initial score in place while attacking.

Code:
void main(){
	void p1Ent = getplayerproperty(0, "entity");
	void p2Ent = getplayerproperty(1, "entity");

	int hres = openborvariant("hresolution");

	if(p1Ent != NULL()){ // When player 1 entity is not empty
		char p1Name = getentityproperty(p1Ent, "name"); //Player 1 entity's name
		char p1Score = getplayerproperty(p1Ent, "score"); //Player 1 entity's score

		int p1NameX = getentityproperty(p1Ent, "x");
		int p1NameZ = getentityproperty(p1Ent, "z");
		int p1NameA = getentityproperty(p1Ent, "y");
		
		if(p1Score){
			drawstring(160+(p1Score/-8),85,0,p1Score);
		}
	}
}
 
you need a if statement to adjust your x position based on how high the score is !


getplayerproperty(playerindex, [/size]"score"[/size])>9
[/size]getplayerproperty(playerindex, [/size]"score"[/size])>99
[/size]getplayerproperty(playerindex, [/size]"score"[/size])>999
[/size]getplayerproperty(playerindex, [/size]"score"[/size])>9999


and so on.
 
I tried to adjust the x position in drawstring and added if statements for player 1's score. However, it just keeps going up like default.

update.c:
Code:
void playerNameScorePos(){
	void p1Ent = getplayerproperty(0, "entity");
	void p2Ent = getplayerproperty(1, "entity");

	int hres = openborvariant("hresolution");

	if(p1Ent != NULL()){ // When player 1 entity is not empty
		char p1Name = getentityproperty(p1Ent, "name"); //Player 1 entity's name
		char p1Score = getplayerproperty(p1Ent, "score"); //Player 1 entity's score
		int p1NameX = getentityproperty(p1Ent, "x");
		int p1NameZ = getentityproperty(p1Ent, "z");
		int p1NameA = getentityproperty(p1Ent, "y");
		
		if(getplayerproperty(p1Ent, "score")){
			drawstring(198,85,1,p1Score);
			if(getplayerproperty(p1Ent, "score">9)){
				drawstring(190,85,0,p1Score);
				if(getplayerproperty(p1Ent, "score">99)){
					drawstring(182,85,0,p1Score);
					if(getplayerproperty(p1Ent, "score">999)){
						drawstring(174,85,0,p1Score);
						if(getplayerproperty(p1Ent, "score">9999)){
							drawstring(166,85,0,p1Score);
							if(getplayerproperty(p1Ent, "score">99999)){
								drawstring(158,85,0,p1Score);
								if(getplayerproperty(p1Ent, "score">999999)){
									drawstring(150,85,0,p1Score);
									if(getplayerproperty(p1Ent, "score">9999999)){
										drawstring(142,85,0,p1Score);
									}
								}
							}
						}
					}
				}
			}
		}
		
	}

	if(p2Ent != NULL()){
		char p2Name = getentityproperty(p2Ent, "name"); //Calling player 2's name
		
		char p2Score = getplayerproperty(p2Ent, "score");
		
		
		int p2NameX = getentityproperty(p2Ent, "x");
		int p2NameZ = getentityproperty(p2Ent, "z");
		int p2NameA = getentityproperty(p2Ent, "y");
		
		
/*		if(p2Score){
			drawstring(254,85,0,p2Score);
		}*/
		if(p2Name){
			drawstring(hres-27-strwidth(p2Name, 0), 55, 0, p2Name);
		}

	}
	
}
 
I figured how to adjust the x position for score. I got it working as msmalik681 described. But the problem is that score overlaps the scripted score that he described. I dunno how that happens.

I edited it as he described but with my own by adding a varname of p1Score.

Code:
//		if(getplayerproperty(p1Ent, "score")){
			drawstring(206,85,0,p1Score);
			if(p1Score>9){
				drawstring(198,85,0,p1Score);
				if(p1Score>99){
					drawstring(190,85,0,p1Score);
					if(p1Score>999){
						drawstring(182,85,0,p1Score);
						if(p1Score>9999){
							drawstring(174,85,0,p1Score);
							if(p1Score>99999){
								drawstring(166,85,0,p1Score);
								if(p1Score>999999){
									drawstring(158,85,0,p1Score);
									if(p1Score>9999999){
										drawstring(150,85,0,p1Score);
										if(p1Score>99999999){
											drawstring(142,85,0,p1Score);
											if(p1Score>999999999){
												drawstring(134,85,0,p1Score);
											}
										}
									}
								}
							}
						}
					}
				}
			}
//		}

A post ago, I misread his answer thinking it was like this.

(getplayerproperty(p1Ent, "score">9))

A moment ago, I realized he meant this.

(getplayerproperty(p1Ent, "score")>9)

Thanks msmalik681. That helped, but one more problem is the overlap.

[attachment deleted by admin]
 
Isn't the case to get the score and store it as a string, then use strlength to chek its size and swift the position?
Take a look: http://www.chronocrash.com/forum/index.php?topic=2891.msg39113#msg39113

Also, in your case, there is some overlaping logic, take a look:

if(p1Score>99){
drawstring(190,85,0,p1Score);
if(p1Score>999){
drawstring(182,85,0,p1Score);
if(p1Score>9999){

The first case of above will the TRUE in all three checks, because 9999 is > 999 and > 99.

And you swould use If...else if... and not a sequence of If. I even think a SWITCH would fit this more.
 
I tried if-else if statement before. It doesn't activate.

Code:
		drawstring(206,85,0,p1Score);
		if(p1Score>9){
			drawstring(198,85,0,p1Score);
		}else if(p1Score>99){
			drawstring(190,85,0,p1Score);
		}else if(p1Score>999){
			drawstring(182,85,0,p1Score);
		}else if(p1Score>9999){
			drawstring(174,85,0,p1Score);
		}else if(p1Score>99999){
			drawstring(166,85,0,p1Score);
		}else if(p1Score>999999){
			drawstring(158,85,0,p1Score);
		}else if(p1Score>9999999){
			drawstring(150,85,0,p1Score);
		}else if(p1Score>99999999){
			drawstring(142,85,0,p1Score);
		}else if(p1Score>999999999){
			drawstring(134,85,0,p1Score);
		}

I also tried using the ones from link, but every time I put the function names in main, it crashes. I tried the switch and case, but I'm lost with what function/variable to use for switch for adjusting x position and score increase.

Code:
		switch(p1Score){
			case "p1Score":
			drawstring(206,85,0,p1Score);
			break;
			case "p1Score">9:
			drawstring(198,85,0,p1Score);
			break;
			case "p1Score">99:
			drawstring(190,85,0,p1Score);
			break;
			case "p1Score">999;
			drawstring(182,85,0,p1Score);
			break;
			case "p1Score">9999;
			drawstring(174,85,0,p1Score);
			break;
			case "p1Score">99999;
			drawstring(166,85,0,p1Score);
			break;
			case "p1Score">999999;
			drawstring(158,85,0,p1Score);
			break;
			case "p1Score">9999999;
			drawstring(150,85,0,p1Score);
			break;
			case "p1Score">99999999;
			drawstring(142,85,0,p1Score);
			break;
			case "p1Score">999999999;
			drawstring(134,85,0,p1Score);
			default:
			drawstring(206,85,0,p1Score);
			break;
		}

EDIT: When I add a string in x of drawstring under if-else if statement, it crashes.

Code:
		drawstring(206,85,0,p1Score);
		if(p1Score>9){
			drawstring(206+(strwidth(p1Score, 0)-8),85,0,p1Score);
		}else if(p1Score>99){
			drawstring(198+(strwidth(p1Score, 0)-8),85,0,p1Score);
		}

Log:
Code:
Total Ram: 4168376320 Bytes
 Free Ram: 267067392 Bytes
 Used Ram: 3112960 Bytes

debug:nativeWidth, nativeHeight, bpp  1366, 768, 32

0 joystick(s) found!
OpenBoR v3.0 Build , Compile Date: Sep  1 2014

Game Selected: ./Paks/mybor.pak

FileCaching System Init......	Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............	320x240 (Mode: 0, Depth: 32 Bit)

Loading menu.txt.............	Done!
Loading fonts................	1 2 3 4 7 Done!
Timer init...................	Done!
Initialize Sound..............	
Loading sprites..............	Done!
Loading level order..........	Done!
Loading model constants......	Done!
Loading script settings......	Done!
Loading scripts..............	Done!
Loading models...............

Cacheing 'Flash' from data/chars/misc/flash.txt
Cacheing 'VF' from data/sprites/VF.txt
Cacheing 'Billy' from data/chars/billy/billy.txt
Cacheing 'Jimmy' from data/chars/jimmy/jimmy.txt
Cacheing 'Lynn' from data/chars/lynn/lynn.txt
Cacheing 'gill' from data/chars/gill/gill.txt
Cacheing 'Ren' from data/chars/renidagawa/renidagawa.txt
Cacheing 'Mpack' from data/chars/misc/mpack.txt
Cacheing '1up' from data/chars/misc/1up.txt
Cacheing 'hamburger' from data/chars/misc/hambur.txt
Cacheing 'Money' from data/chars/misc/money.txt
Cacheing 'Meat' from data/chars/misc/meat.txt
Cacheing 'Knife' from data/chars/misc/knife.txt
Cacheing 'Box' from data/chars/misc/box.txt
Cacheing 'Buntaro' from data/chars/buntaro/buntaro.txt
Cacheing 'Shintaro' from data/chars/shintaro/shintaro.txt
Cacheing 'Jack' from data/chars/jack/jack.txt
Cacheing 'Chinnen' from data/chars/chinnen/chinnen.txt
Cacheing 'Olof' from data/chars/olof/olof.txt
Cacheing 'Flogger' from data/chars/flogger/flogger.txt
Cacheing 'Empty' from data/chars/misc/empty.txt
Cacheing 'Wong' from data/chars/cheng/cheng.txt
Cacheing 'Kulio' from data/chars/yun/yun.txt
Cacheing 'Dingo' from data/chars/dingo/dingo.txt
Cacheing 'Iggy' from data/chars/iggy/iggy.txt
Cacheing 'Eagle' from data/chars/eagle/eagle.txt
Cacheing 'Duck' from data/chars/duck/duck.txt
Cacheing 'Abubo' from data/chars/abubo/abubo.txt
Cacheing 'Burnov' from data/chars/burnov/burnov.txt
Cacheing 'Sonia' from Data/Chars/Sonia/Sonia.txt
Cacheing 'Sonia2' from Data/chars/Sonia/Sonia2.txt
Cacheing 'Captain_Commando' from Data/chars/capcom/CapCom.txt
Cacheing 'Baby_Head' from Data/chars/BabyCommando/babyhead.txt
Cacheing 'cvsryu' from data/chars/cvsryu/cvsryu.txt
Cacheing 'Shadow_Stg3' from data/chars/misc/shdwstg3.txt
Cacheing 'Eliza' from data/chars/Eliza/Eliza.txt
Cacheing 'Ralf' from data/chars/ralf/ralf.txt
Cacheing 'Kula' from data/chars/kula/kula.txt
Cacheing 'Lesus' from data/chars/lesus/lesus.txt
Cacheing 'Gale' from data/chars/lesus/lesus2.txt
Cacheing 'Thunder' from data/chars/lesus/lesus3.txt
Cacheing 'Petir' from data/chars/lesus/lesuss.txt
Cacheing 'Bao' from data/chars/bao/bao.txt
Cacheing 'Maxima' from data/chars/maxima/maxima.txt
Cacheing 'Athena' from data/chars/athena/athena.txt
Cacheing 'zedd' from data/chars/zedd/zedd.txt
Cacheing 'fadeoutwhite' from data/chars/misc/fade/fadeoutwhite.txt
Cacheing 'idlezedd1' from data/chars/misc/idlezedd1.txt
Cacheing 'idlezedd2' from data/chars/misc/idlezedd2.txt
Cacheing 'lightning' from data/chars/misc/lightning/lightning.txt
Cacheing 'Jimmy-E' from data/chars/jimmy/jimmye.txt
Cacheing 'EMPTY_WEAP' from data/chars/misc/empty_weap.txt
Cacheing 'endlevel_empty' from data/chars/misc/endlevel_empty.txt
Cacheing 'lenny' from data/chars/lenny/lenny.txt
Cacheing '1spawn' from data/chars/misc/1spawn.txt
Cacheing 'wsample' from Data/chars/Misc/wsample.txt
Cacheing 'wsample2' from data/chars/misc/wsample2.txt
Cacheing 'wsample1' from data/chars/misc/wsample1.txt
Cacheing 'wsample3' from data/chars/misc/wsample3.txt
Cacheing 'fronside' from data/chars/misc/fronside.txt
Cacheing 'wsample4' from data/chars/misc/wsample4.txt
Cacheing 'wsample5' from data/chars/misc/wsample5.txt
Cacheing 'wsample6' from data/chars/misc/wsample6.txt
Cacheing 'sideway' from data/chars/misc/sideway.txt
Cacheing 'halfplat' from data/chars/misc/halfplat.txt
Cacheing 'plat1' from data/chars/misc/plat1.txt
Cacheing '25plat' from data/chars/misc/25plat.txt
Cacheing 'plathalf' from data/chars/misc/plathalf.txt
Cacheing 'plata' from Data/chars/Misc/plata/plata.txt
Cacheing 'hplat1' from data/chars/misc/plata/hplat1.txt
Cacheing 'hplat2' from data/chars/misc/plata/hplat2.txt
Cacheing 'Q-None' from Data/chars/Misc/Q/Q-None.txt

Loading 'Flash' from data/chars/misc/flash.txt
Loading 'VF' from data/sprites/VF.txt
Loading 'Billy' from data/chars/billy/billy.txt
Loading 'Jimmy' from data/chars/jimmy/jimmy.txt
Loading 'Lynn' from data/chars/lynn/lynn.txt
Loading 'Gill' from data/chars/gill/gill.txt
Loading 'Sonia' from Data/Chars/Sonia/Sonia.txt
Loading 'Captain_Commando' from Data/chars/capcom/CapCom.txt
Loading 'Baby_Head' from Data/chars/BabyCommando/babyhead.txt
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/grab.wav'!
Loading 'Ralf' from data/chars/ralf/ralf.txt
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Kula' from data/chars/kula/kula.txt
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Bao' from data/chars/bao/bao.txt
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/maxboom.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Maxima' from data/chars/maxima/maxima.txt
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Athena' from data/chars/athena/athena.txt

Loading models...............	Done!
Object engine init...........	Done!
Input init...................	No Joystick(s) Found!
Done!
Create blending tables.......	Done!
Save settings so far........	Done!



Can't play music file 'data/music/remix'

Can't play music file 'data/music/remix'

Can't play music file 'data/music/remix'
Level Loading:   'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 228663296 Bytes
 Used Ram: 31559680 Bytes

sound_load_sample can't load sample from file 'data/chars/buntaro/bundie.wav'!
Loading 'Flogger' from data/chars/flogger/flogger.txt
Loading 'Buntaro' from data/chars/buntaro/buntaro.txt
sound_load_sample can't load sample from file 'data/chars/shintaro/shindie.wav'!
Command '5' not understood in file 'data/chars/shintaro/shintaro.txt'!
Command '10' not understood in file 'data/chars/shintaro/shintaro.txt'!
Loading 'Shintaro' from data/chars/shintaro/shintaro.txt
sound_load_sample can't load sample from file 'data/chars/olof/olofcry.wav'!
Loading 'Olof' from data/chars/olof/olof.txt
sound_load_sample can't load sample from file 'data/chars/chinnen/chindie.wav'!
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Loading 'Chinnen' from data/chars/chinnen/chinnen.txt
sound_load_sample can't load sample from file 'data/sounds/sukedie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Iggy' from data/chars/iggy/iggy.txt
sound_load_sample can't load sample from file 'data/sounds/EAgledie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Eagle' from data/chars/eagle/eagle.txt
sound_load_sample can't load sample from file 'data/sounds/chumpdie.wav'!
WARNING: data/chars/cheng/cheng.txt tries to load a nonnumeric value at load, where a number is expected!
erroneus string: data/chars/misc/knife.txt
Loading 'Knife' from data/chars/misc/knife.txt
Loading 'Wong' from data/chars/cheng/cheng.txt
sound_load_sample can't load sample from file 'data/sounds/sukedie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Dingo' from data/chars/dingo/dingo.txt
sound_load_sample can't load sample from file 'data/chars/buntaro/bundie.wav'!
Loading 'Jack' from data/chars/jack/jack.txt
sound_load_sample can't load sample from file 'data/sounds/wood.wav'!
Loading 'Box' from data/chars/misc/box.txt
Loading 'BURGER' from data/chars/misc/hambur.txt
Loading 'MPACK' from data/chars/misc/mpack.txt

Level Loaded:    'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 217571328 Bytes
 Used Ram: 35532800 Bytes
Total sprites mapped: 2499

Error, strwidth({string}, {font}): Invalid or missing parameter.
Script function 'strwidth' returned an exception, check the manual for details.
 parameters: 40, 0,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'update' Total Ram: 4168376320 Bytes
 Free Ram: 230662144 Bytes
 Used Ram: 35684352 Bytes

Release level data...........Level Unloading: 'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 230662144 Bytes
 Used Ram: 35684352 Bytes

Done.
Total Ram: 4168376320 Bytes
 Free Ram: 230662144 Bytes
 Used Ram: 35684352 Bytes

	Done!
Release graphics data........	Done!
Release game data............

Unload 'Flash' ............done.
Unload 'VF' ............done.
Unload 'Billy' ............done.
Unload 'Jimmy' ............done.
Unload 'Lynn' ............done.
Unload 'Gill' ............done.
Unload 'Sonia' ............done.
Unload 'Captain_Commando' ............done.
Unload 'Baby_Head' ............done.
Unload 'Ralf' ............done.
Unload 'Kula' ............done.
Unload 'Bao' ............done.
Unload 'Maxima' ............done.
Unload 'Athena' ............done.
Unload 'Flogger' ............done.
Unload 'Buntaro' ............done.
Unload 'Shintaro' ............done.
Unload 'Olof' ............done.
Unload 'Chinnen' ............done.
Unload 'Iggy' ............done.
Unload 'Eagle' ............done.
Unload 'Wong' ............done.
Unload 'Knife' ............done.
Unload 'Dingo' ............done.
Unload 'Jack' ............done.
Unload 'Box' ............done.
Unload 'BURGER' ............done.
Unload 'MPACK' ............done.

Release game data............	Done!
Release timer................	Done!
Release input hardware.......	Done!
Release sound system.........	Done!
Release FileCaching System...	Done!

**************** Done *****************

There's an exception while executing script 'update'
 
I dont think switch is supported and for your if statement try:

If (p1score != NULL ())
{
New if statements here for the x adjustment.
}

Also with the further if else statements have the higher numbers first then work your way down to >9 as the last one.

I would only make 1 drawstring with a declared variable as  x and have the if statement before it so it adjusts the x coordinate as needed.
 
I tried to follow your way, msmalik, but I'm having trouble with declaring a variable for x position in drawstring.

Code:
	if(p1Score != NULL()){
		//int x = getentityproperty(p1Score, "x");
		int x; int y; int n;
		//x = drawstring();
	//	int z = getentityproperty(p1Score, "z");
	//	int y = getentityproperty(p1Score, "a");
		
		drawstring(206-(x),85,0,p1Score);
		if(p1Score>999999999) x=72;// drawstring(134,85,0,p1Score);
		else if(p1Score>99999999) x=64;// drawstring(142,85,0,p1Score);
		else if(p1Score>9999999) x=56;// drawstring(150,85,0,p1Score);
		else if(p1Score>999999) x=48;// drawstring(158,85,0,p1Score);
		else if(p1Score>99999) x=40;// drawstring(166,85,0,p1Score);
		else if(p1Score>9999) x=32;// drawstring(174,85,0,p1Score);
		else if(p1Score>999) x=24;// drawstring(182,85,0,p1Score);
		else if(p1Score>99) x=16;// drawstring(190,85,0,p1Score);
		else if(getplayerproperty(0, "score")>9) x=8;// drawstring(198,85,0,p1Score);

	}

Code:
Total Ram: 4168376320 Bytes
 Free Ram: 830853120 Bytes
 Used Ram: 3145728 Bytes

debug:nativeWidth, nativeHeight, bpp  1366, 768, 32

0 joystick(s) found!
OpenBoR v3.0 Build , Compile Date: Sep  1 2014

Game Selected: ./Paks/mybor.pak

FileCaching System Init......	Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............	320x240 (Mode: 0, Depth: 32 Bit)

Loading menu.txt.............	Done!
Loading fonts................	1 2 3 4 7 Done!
Timer init...................	Done!
Initialize Sound..............	
Loading sprites..............	Done!
Loading level order..........	Done!
Loading model constants......	Done!
Loading script settings......	Done!
Loading scripts..............	Done!
Loading models...............

Cacheing 'Flash' from data/chars/misc/flash.txt
Cacheing 'VF' from data/sprites/VF.txt
Cacheing 'Billy' from data/chars/billy/billy.txt
Cacheing 'Jimmy' from data/chars/jimmy/jimmy.txt
Cacheing 'Lynn' from data/chars/lynn/lynn.txt
Cacheing 'gill' from data/chars/gill/gill.txt
Cacheing 'Ren' from data/chars/renidagawa/renidagawa.txt
Cacheing 'Mpack' from data/chars/misc/mpack.txt
Cacheing '1up' from data/chars/misc/1up.txt
Cacheing 'hamburger' from data/chars/misc/hambur.txt
Cacheing 'Money' from data/chars/misc/money.txt
Cacheing 'Meat' from data/chars/misc/meat.txt
Cacheing 'Knife' from data/chars/misc/knife.txt
Cacheing 'Box' from data/chars/misc/box.txt
Cacheing 'Buntaro' from data/chars/buntaro/buntaro.txt
Cacheing 'Shintaro' from data/chars/shintaro/shintaro.txt
Cacheing 'Jack' from data/chars/jack/jack.txt
Cacheing 'Chinnen' from data/chars/chinnen/chinnen.txt
Cacheing 'Olof' from data/chars/olof/olof.txt
Cacheing 'Flogger' from data/chars/flogger/flogger.txt
Cacheing 'Empty' from data/chars/misc/empty.txt
Cacheing 'Wong' from data/chars/cheng/cheng.txt
Cacheing 'Kulio' from data/chars/yun/yun.txt
Cacheing 'Dingo' from data/chars/dingo/dingo.txt
Cacheing 'Iggy' from data/chars/iggy/iggy.txt
Cacheing 'Eagle' from data/chars/eagle/eagle.txt
Cacheing 'Duck' from data/chars/duck/duck.txt
Cacheing 'Abubo' from data/chars/abubo/abubo.txt
Cacheing 'Burnov' from data/chars/burnov/burnov.txt
Cacheing 'Sonia' from Data/Chars/Sonia/Sonia.txt
Cacheing 'Sonia2' from Data/chars/Sonia/Sonia2.txt
Cacheing 'Captain_Commando' from Data/chars/capcom/CapCom.txt
Cacheing 'Baby_Head' from Data/chars/BabyCommando/babyhead.txt
Cacheing 'cvsryu' from data/chars/cvsryu/cvsryu.txt
Cacheing 'Shadow_Stg3' from data/chars/misc/shdwstg3.txt
Cacheing 'Eliza' from data/chars/Eliza/Eliza.txt
Cacheing 'Ralf' from data/chars/ralf/ralf.txt
Cacheing 'Kula' from data/chars/kula/kula.txt
Cacheing 'Lesus' from data/chars/lesus/lesus.txt
Cacheing 'Gale' from data/chars/lesus/lesus2.txt
Cacheing 'Thunder' from data/chars/lesus/lesus3.txt
Cacheing 'Petir' from data/chars/lesus/lesuss.txt
Cacheing 'Bao' from data/chars/bao/bao.txt
Cacheing 'Maxima' from data/chars/maxima/maxima.txt
Cacheing 'Athena' from data/chars/athena/athena.txt
Cacheing 'zedd' from data/chars/zedd/zedd.txt
Cacheing 'fadeoutwhite' from data/chars/misc/fade/fadeoutwhite.txt
Cacheing 'idlezedd1' from data/chars/misc/idlezedd1.txt
Cacheing 'idlezedd2' from data/chars/misc/idlezedd2.txt
Cacheing 'lightning' from data/chars/misc/lightning/lightning.txt
Cacheing 'Jimmy-E' from data/chars/jimmy/jimmye.txt
Cacheing 'EMPTY_WEAP' from data/chars/misc/empty_weap.txt
Cacheing 'endlevel_empty' from data/chars/misc/endlevel_empty.txt
Cacheing 'lenny' from data/chars/lenny/lenny.txt
Cacheing '1spawn' from data/chars/misc/1spawn.txt
Cacheing 'wsample' from Data/chars/Misc/wsample.txt
Cacheing 'wsample2' from data/chars/misc/wsample2.txt
Cacheing 'wsample1' from data/chars/misc/wsample1.txt
Cacheing 'wsample3' from data/chars/misc/wsample3.txt
Cacheing 'fronside' from data/chars/misc/fronside.txt
Cacheing 'wsample4' from data/chars/misc/wsample4.txt
Cacheing 'wsample5' from data/chars/misc/wsample5.txt
Cacheing 'wsample6' from data/chars/misc/wsample6.txt
Cacheing 'sideway' from data/chars/misc/sideway.txt
Cacheing 'halfplat' from data/chars/misc/halfplat.txt
Cacheing 'plat1' from data/chars/misc/plat1.txt
Cacheing '25plat' from data/chars/misc/25plat.txt
Cacheing 'plathalf' from data/chars/misc/plathalf.txt
Cacheing 'plata' from Data/chars/Misc/plata/plata.txt
Cacheing 'hplat1' from data/chars/misc/plata/hplat1.txt
Cacheing 'hplat2' from data/chars/misc/plata/hplat2.txt
Cacheing 'Q-None' from Data/chars/Misc/Q/Q-None.txt

Loading 'Flash' from data/chars/misc/flash.txt
Loading 'VF' from data/sprites/VF.txt
Loading 'Billy' from data/chars/billy/billy.txt
Loading 'Jimmy' from data/chars/jimmy/jimmy.txt
Loading 'Lynn' from data/chars/lynn/lynn.txt
Loading 'Gill' from data/chars/gill/gill.txt
Loading 'Sonia' from Data/Chars/Sonia/Sonia.txt
Loading 'Captain_Commando' from Data/chars/capcom/CapCom.txt
Loading 'Baby_Head' from Data/chars/BabyCommando/babyhead.txt
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/grab.wav'!
Loading 'Ralf' from data/chars/ralf/ralf.txt
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Kula' from data/chars/kula/kula.txt
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Bao' from data/chars/bao/bao.txt
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/maxboom.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Maxima' from data/chars/maxima/maxima.txt
sound_load_sample can't load sample from file 'data/sounds/jolted.wav'!
sound_load_sample can't load sample from file 'data/sounds/bukk.wav'!
sound_load_sample can't load sample from file 'data/sounds/slam.wav'!
Loading 'Athena' from data/chars/athena/athena.txt

Loading models...............	Done!
Object engine init...........	Done!
Input init...................	No Joystick(s) Found!
Done!
Create blending tables.......	Done!
Save settings so far........	Done!



Can't play music file 'data/music/remix'

Can't play music file 'data/music/remix'

Can't play music file 'data/music/remix'
Level Loading:   'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 804192256 Bytes
 Used Ram: 31395840 Bytes

sound_load_sample can't load sample from file 'data/chars/buntaro/bundie.wav'!
Loading 'Flogger' from data/chars/flogger/flogger.txt
Loading 'Buntaro' from data/chars/buntaro/buntaro.txt
sound_load_sample can't load sample from file 'data/chars/shintaro/shindie.wav'!
Command '5' not understood in file 'data/chars/shintaro/shintaro.txt'!
Command '10' not understood in file 'data/chars/shintaro/shintaro.txt'!
Loading 'Shintaro' from data/chars/shintaro/shintaro.txt
sound_load_sample can't load sample from file 'data/chars/olof/olofcry.wav'!
Loading 'Olof' from data/chars/olof/olof.txt
sound_load_sample can't load sample from file 'data/chars/chinnen/chindie.wav'!
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Warning: Failed to create colourmap. Failed to load file 2
Loading 'Chinnen' from data/chars/chinnen/chinnen.txt
sound_load_sample can't load sample from file 'data/sounds/sukedie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Iggy' from data/chars/iggy/iggy.txt
sound_load_sample can't load sample from file 'data/sounds/EAgledie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Eagle' from data/chars/eagle/eagle.txt
sound_load_sample can't load sample from file 'data/sounds/chumpdie.wav'!
WARNING: data/chars/cheng/cheng.txt tries to load a nonnumeric value at load, where a number is expected!
erroneus string: data/chars/misc/knife.txt
Loading 'Knife' from data/chars/misc/knife.txt
Loading 'Wong' from data/chars/cheng/cheng.txt
sound_load_sample can't load sample from file 'data/sounds/sukedie.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
sound_load_sample can't load sample from file 'data/sounds/MALEPAIN.wav'!
Loading 'Dingo' from data/chars/dingo/dingo.txt
sound_load_sample can't load sample from file 'data/chars/buntaro/bundie.wav'!
Loading 'Jack' from data/chars/jack/jack.txt
sound_load_sample can't load sample from file 'data/sounds/wood.wav'!
Loading 'Box' from data/chars/misc/box.txt
Loading 'BURGER' from data/chars/misc/hambur.txt
Loading 'MPACK' from data/chars/misc/mpack.txt

Level Loaded:    'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 797245440 Bytes
 Used Ram: 35196928 Bytes
Total sprites mapped: 2499

First 3 values must be integer values and 4th value a string: drawstring(int x, int y, int font, value)
Script function 'drawstring' returned an exception, check the manual for details.
 parameters: <VT_EMPTY>   Unitialized, 85, 0, 0,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'update' Total Ram: 4168376320 Bytes
 Free Ram: 797224960 Bytes
 Used Ram: 35217408 Bytes

Release level data...........Level Unloading: 'data/levels/90210.txt'
Total Ram: 4168376320 Bytes
 Free Ram: 797224960 Bytes
 Used Ram: 35217408 Bytes

Done.
Total Ram: 4168376320 Bytes
 Free Ram: 797233152 Bytes
 Used Ram: 35217408 Bytes

	Done!
Release graphics data........	Done!
Release game data............

Unload 'Flash' ............done.
Unload 'VF' ............done.
Unload 'Billy' ............done.
Unload 'Jimmy' ............done.
Unload 'Lynn' ............done.
Unload 'Gill' ............done.
Unload 'Sonia' ............done.
Unload 'Captain_Commando' ............done.
Unload 'Baby_Head' ............done.
Unload 'Ralf' ............done.
Unload 'Kula' ............done.
Unload 'Bao' ............done.
Unload 'Maxima' ............done.
Unload 'Athena' ............done.
Unload 'Flogger' ............done.
Unload 'Buntaro' ............done.
Unload 'Shintaro' ............done.
Unload 'Olof' ............done.
Unload 'Chinnen' ............done.
Unload 'Iggy' ............done.
Unload 'Eagle' ............done.
Unload 'Wong' ............done.
Unload 'Knife' ............done.
Unload 'Dingo' ............done.
Unload 'Jack' ............done.
Unload 'Box' ............done.
Unload 'BURGER' ............done.
Unload 'MPACK' ............done.

Release game data............	Done!
Release timer................	Done!
Release input hardware.......	Done!
Release sound system.........	Done!
Release FileCaching System...	Done!

**************** Done *****************

There's an exception while executing script 'update'

I tried using getentityproperty for player 1's score x position before, but it crashed.
 
here is the script you need and some tips are to unpack and try to understand scripts in heavily scripted games like rocket viper, crime busters and dungeons and dragons rise of the war duke.

Code:
void main()
{
int score = getplayerproperty(getlocalvar("player"), "score"); //get calling players score
float x = 150; //set default score location if score is single digit


if(score>999999999) //these are all the adjustments
{
x = 105;
}else if(score>99999999)
{
x = 110;
}else if(score>9999999)
{
x = 115;
}else if(score>999999)
{
x = 120;
}else if(score>99999)
{
x = 125;
}else if(score>9999)
{
x = 130;
}else if(score>999)
{
x = 135;
}else if(score>99)
{
x = 140;
}else if(score>9)
{
x = 145;
}


drawstring(x, 100, 0, score); //draw score to screen
}


the drwstring co ordinates i used were just to make you a template adjust as needed and use pscore in levels.txt to move real score off screen. HTH
 
It works. I didn't think/know it would be like that. Thanks for the script, but I have those unpacked especially Crime Buster(s) for script references though. I unpack mods that have scripts when I wanna learn from them. Rocket Viper is a little complex to understand but it's a little too much script to read. I will need to study some more.

For score, I know. I will move it out of screen later.

Look at these score positions below to see the difference (please ignore p1score that's above player's lifebar).

mybor___0045.png


mybor___0046.png


mybor___0047.png


mybor___0048.png


mybor___0049.png


Thank you, msmalik. You solved my problem even 1 gets jumpy. ;)

EDIT: Nevermind. I can adjust the x myself with >9 and <20 easily.
 
Back
Top Bottom