Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (VoroneTZ, TipmyPip), 1,333 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Digits Probs :X #412695
12/01/12 16:10
12/01/12 16:10
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
typedef struct UserProfile
	{
		STRING * Name;
		STRING * Password;
		
		STRING * EMail;
		Date DOB;
		Date DOC;
		
		int BPI;
		int XP;
		
		int RegionSpeed;
		int RegionMemory;
		int RegionAttentition;
		int RegionFlexibility; 
		int RegionLogic;
		
		int Rank;
		int BestRegion;
		int TexPoints;
		int MostCommonRegion;
		int BestRegion;
		
		int SelectedRegion;
	}UserProfile;


Code:
PANEL * V10StatsDialog =
{
	event = MoveWindow;
	button(580,6,XButtonClicked,XButtonNormal,XButtonNormal,FormXButtonClicked,NULL,NULL);
	digits(5,5,"My Stats",DialogTitle,1,0);
	digits(10,40,"BrainPerformanceIndex:%d",DialogSubText,1,ActiveProfile.BPI);
	digits(10,100,"Speed:%d",DialogSubText,1,ActiveProfile.RegionSpeed);
	digits(10,140,"Memory:%d",DialogSubText,1,ActiveProfile.RegionMemory);
	digits(10,180,"Flexibility:%d",DialogSubText,1,ActiveProfile.RegionFlexibility);
	digits(10,220,"Problem Solving:%d",DialogSubText,1,ActiveProfile.RegionLogic);
	digits(10,260,"Attentition:%d",DialogSubText,1,ActiveProfile.RegionAttentition);
	
	digits(10,360,"Rank:%d",DialogSubText,1,ActiveProfile.Rank);
	digits(10,400,"XP:%d",DialogSubText,1,ActiveProfile.XP);
	

	digits(10,460,"Rank 1:",DialogSubText,1,0);
	digits(10,500,"Rank 2:",DialogSubText,1,0);
	digits(10,540,"Rank 3:",DialogSubText,1,0);
	
	digits(110,460,"%s",DialogSubText,1,0);
	digits(110,500,"%s",DialogSubText,1,0);
	digits(110,540,"%s",DialogSubText,1,0);
	
	
	
	alpha = 0;
	bmap = DialogBackground;
	layer = 5;
	flags = TRANSLUCENT;
}



If ActiveProfile.BPI is 20 I get the digits in the PANEL showing 0!
Wats wrong here???

Thanks


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Digits Probs :X [Re: Yashas] #412700
12/01/12 17:40
12/01/12 17:40
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
the digits element doesn't support integers.

There's a workaround but I'm not sure if this really isn't causing trouble to the rest of the code:
Code:
digits(10,40,"BrainPerformanceIndex:%f",DialogSubText,1024,ActiveProfile.BPI);



EDIT: since you're using an integer use %.0f in the format string to cut off the .00000

Last edited by Kartoffel; 12/01/12 17:43.

POTATO-MAN saves the day! - Random
Re: Digits Probs :X [Re: Kartoffel] #412701
12/01/12 17:43
12/01/12 17:43
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
The correct format pattern for integers is %d, not %f!

http://www.cplusplus.com/reference/cstdio/printf/


Always learn from history, to be sure you make the same mistakes again...
Re: Digits Probs :X [Re: Uhrwerk] #412702
12/01/12 17:45
12/01/12 17:45
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I know but this doesn't work for digits...
(I think it only supports %s and %f)

Last edited by Kartoffel; 12/01/12 17:46.

POTATO-MAN saves the day! - Random
Re: Digits Probs :X [Re: Kartoffel] #412708
12/01/12 19:04
12/01/12 19:04
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Who the hell uses digits?
Use str_printf and draw_text..

Re: Digits Probs :X [Re: Ch40zzC0d3r] #412709
12/01/12 19:24
12/01/12 19:24
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Who the hell writes shitty "answers" like yours?


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Digits Probs :X [Re: WretchedSid] #412712
12/01/12 19:55
12/01/12 19:55
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
Also note that %i means integer in c++ but i dont know if
gs supports it you could try "%d",(long)value or "%d",(int)value or "%d",integer(value)
and i dont know if this is relevant but you could printf the value into the text
and use the text in the digit field perhaps if printf supports more formatting


Compulsive compiler
Re: Digits Probs :X [Re: Wjbender] #412713
12/01/12 20:04
12/01/12 20:04
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
tested it, gs supports neither %d nor %i.
combining the var parameter with a cast operator results in a compiling error ('[..] too many parameters [..]')

(edit: we're still talking about the digits-element, right?)

Last edited by Kartoffel; 12/01/12 20:07.

POTATO-MAN saves the day! - Random
Re: Digits Probs :X [Re: Kartoffel] #412726
12/02/12 04:28
12/02/12 04:28
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
Code:
digits(10,40,"BrainPerformanceIndex:%0.f",DialogSubText,1,ActiveProfile.BPI);


shows a zero always even though the BPI value is something else.

When I remove Active...BPI parameter and install any integer ,it works!!
Code:
digits(10,40,"BrainPerformanceIndex:%0.f",DialogSubText,1,34);



Why is not ActiveProfile.BPI not working??


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Re: Digits Probs :X [Re: Yashas] #412728
12/02/12 04:34
12/02/12 04:34
Joined: Nov 2011
Posts: 139
India
Yashas Offline OP
Member
Yashas  Offline OP
Member

Joined: Nov 2011
Posts: 139
India
^^When I set ActiveProfile.BPI to 443000 it shows 433 smirk


Keep smiling laugh
http://translation.babylon.com/ - Translate many languages
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1