Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Printing Player Stats Variables With dbText()

Author
Message
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 7th Oct 2008 09:54
I cant seem to be able to print my player stats variables to display on my HUD... anyone got any ideas?

BTW, where is there a 'db' in front of everything? Why db?

Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 7th Oct 2008 10:01
dbText ( 0, 0, "Health = " PlayerHealth ) ;

should maybe be:

dbText ( 0, 0, "Health = %s", PlayerHealth ) ;

Im not a C++ expert but I have seen something like this.

The reason that there are db infront of all commands is because it comes from DarkBasic.

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 7th Oct 2008 10:18
Quote: "dbText ( 0, 0, "Health = " PlayerHealth ) ;

should maybe be:

dbText ( 0, 0, "Health = %s", PlayerHealth ) ;

Im not a C++ expert but I have seen something like this."



1>c:\users\rei\documents\visual studio 2008\projects\gun\gun\hud.h(9) : error C2660: 'dbText' : function does not take 4 arguments
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 7th Oct 2008 10:38
Did you try to search on the forum? Try search for dbText

I found this within 30 seconds




then you just need to find out how to put integer and string together in C++

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 7th Oct 2008 20:10
Quote: "BTW, where is there a 'db' in front of everything? Why db?"


db stands for Dark Basic. When functions are created it's not advisable to give them generic names like "Print" because you may end up with conflicts in other libraries that include functions with the same names. It's typical to prefix function names with something that ties it to the package it's associated with. Since these functions derive from functions in Dark Basic, db is the obvious choice.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
ReiKumar
16
Years of Service
User Offline
Joined: 23rd Sep 2008
Location:
Posted: 7th Oct 2008 23:03
Quote: "Did you try to search on the forum? Try search for dbText

I found this within 30 seconds


+ Code Snippet

char* xtext = dbStr(dbCameraPositionX());
dbText ( 0, 0, xtext);



then you just need to find out how to put integer and string together in C++"




Thanks
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 9th Oct 2008 01:25
If I remember right you can do something like this

int test = 22;
char* text_test = static_cast<char>(test);
dbText(0,0,text_test);

Jonas
19
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 10th Oct 2008 02:05 Edited at: 10th Oct 2008 02:28
This might help: http://www.cppreference.com/wiki/string/append

Edit: my bad... *shuts up now*

P4 3.4ghz/2gb RAM (+PF=24gb)/GeForce 6200 A-LE 256meg AGP8x (Altered for 16pipelines, 768mb forced TurboCache-ish)/WinXP Pro/74gb WDRaptor(SATA,OS)/3x 200gb WDCaviar(IDE)/250gb WDCaviar SE16(SATA)
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 10th Oct 2008 02:13 Edited at: 10th Oct 2008 02:14
Either sprintf(?) or itoa(). Take your pick.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 11th Oct 2008 20:15
You guys are just making it too long

I work with this:

int Health;
dbText( whateverx , whatevery , dbStr(Health) );

dbStr() does the whole thing for you.

Chamillion

You can only get smarter by facing a smarter opponent.

Login to post a reply

Server time is: 2024-09-30 07:18:24
Your offset time is: 2024-09-30 07:18:24