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 / Cannot Convert int to string

Author
Message
arithehun
8
Years of Service
User Offline
Joined: 27th Apr 2010
Location:
Posted: 28th Apr 2010 02:09
I am taking a great Dark Basic tutorial, and turning it into Dark GDK as I go along, as I am unwilling to pay $60 for an inferior compiler(DB). This has gone fine, until I needed it to display the ammo on the screen. In the tutorial, I needed to convert an integer to a string. I new to give: int ammo=5000; instead of: ammo#=5000. However, to display it on the screen, I needed to convert it to a string. This totally lost me, because I could tell right off the bat that the code they used wouldn't work for me, because it had many Dark Basic principles.
Here is the code they used:

Here is what I have so far in Dark GDK:


And here is the finished project in Dark Basic:

Does this help? And please help me! I was really having fun!

And thank you too.

I am new to Dark GDK. However, I love it! It is really easy, fun, and makes perfect sense.

Attachments

Login to view attachments
Hassan
9
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 28th Apr 2010 15:21
use sprintf:

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/

Bran flakes91093
10
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 28th Apr 2010 21:41
Here:



Are you trying to decrement 'ammo'? Use "ammo--;" to decrement it by one or "ammo -= 5" to decrement it by 5. Also change 'enemyhp'.

"A computer once beat me at chess, but it was no match for me at kick boxing."
Emo Philips
entomophobiac
16
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 29th Apr 2010 08:25
If this works in DB:




You can do this in C++:

Login to post a reply

Server time is: 2019-02-17 17:13:52
Your offset time is: 2019-02-17 17:13:52