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.

Newcomers DBPro Corner / % of health left

Author
Message
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 15th Jan 2007 21:20
OK guys,

i haven't found anything usefull about this on the help or the forums,so i'd like to know,how to get the % of a value left(Like: if Health#=100% then blablabla)

Sorry if it has bein answered,but i couldnt find it.

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 15th Jan 2007 21:27
You mean like:
?

Pirates of Port Royale
Live the life of a pirate.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 15th Jan 2007 21:31
Yes...

i meant like that.

Thanks Gil.

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 15th Jan 2007 21:44
no problem .

Pirates of Port Royale
Live the life of a pirate.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Jan 2007 23:11 Edited at: 15th Jan 2007 23:12
yeah, like Gil Galvanti did, just divide the "part" (current health) by the "whole" (original health) to get the percentage.

[edit] looking back, this post seems kind of useless... but oh well

One man, one lawnmower, plenty of angry groundhogs.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Jan 2007 02:48
Prince of Darkness, you really shouldn't use a float for health... unless you want to reduce the health by fractions. Integers are better for a health stat.
Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 16th Jan 2007 15:55
What is an integer anyway???

i just type # for a number and $ for a string.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Jan 2007 22:30
Quote: "i just type # for a number and $ for a string."


That's why we write tutorials for beginners! There's probably a lot of other basic DB stuff lots of users aren't aware of if they don't read them.

I know they can take time to read - that you would probably prefer to spend coding - but they save you time in the long run.

If I say Integers and Floats, does it not mean anything to you?

If not, go and read a tutorial which covers variables as soon as possible!

TDK_Man

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 16th Jan 2007 23:44
Integer is a number without decimals, a float with .

Pirates of Port Royale
Live the life of a pirate.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Jan 2007 07:24 Edited at: 17th Jan 2007 07:26
Don't feel bad. It's a common mistake to assume that the # sign means number (even for people that have been programming for years). It's like Gil Galvanti said. An integer is a number without a decimal point and a float is a number with a decimal point. In code if we add a # sign to a variable that variable is capable of having a decimal point. If we make a variable without the # sign it's an integer.



In the code above 1 is added to "IntegerNumber" and .1 to "FloatNumber". If you change it to .1 for "IntegerNumber" it won't work because integers cannot use decimals at all. And as you can see floats get out of hand with decimal places but thats normal too.

Do what TDK suggested and look at the help files again... just remember "real" is the same thing as "float".
Dared1111
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location:
Posted: 17th Jan 2007 09:16
Might as well post my question here

How do i do message boxes?

Game progress- 30 percent

working on character movement,powers and inventory, soon be doing monsters maybe
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Jan 2007 09:34
That depends on what a message box is to you. Describe what you're wanting a message box to be.
Dared1111
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location:
Posted: 17th Jan 2007 19:53
like a semi transparent message that a character tells you which fills up most of the screen with text showing what the character is saying and being able to delete the text without deleting everything

Game progress- 30 percent

working on character movement,powers and inventory, soon be doing monsters maybe
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 18th Jan 2007 01:44 Edited at: 18th Jan 2007 01:53
The easiest way to not change the background is to use a sprite but depending on if you use Classic or Pro determines if it's possible to make that sprite semi-transparent.

The following code snip has a transparent thought bubble in Pro but solid in Classic:



Edit: The graphic has both the thought bubble and the text. What you do to separate them is to change the current bitmap to 1, paste the graphic, write your text, grab the image and use that to create the sprite. Or if it's going to be scripted just add the text to the box (like I did).

Attachments

Login to view attachments
Dared1111
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location:
Posted: 19th Jan 2007 16:27
thanks the only thing is it cannot load it with me

Game progress- 30 percent

working on character movement,powers and inventory, soon be doing monsters maybe
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Jan 2007 08:19
Huh? That code snip doesn't work for you?
Dared1111
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location:
Posted: 20th Jan 2007 15:27
the image wont load

Game progress- 30 percent

working on character movement,powers and inventory, soon be doing monsters maybe
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Jan 2007 04:53
Pngs should work in Classic. Did you put the file in the same directory as the code?

Login to post a reply

Server time is: 2024-11-26 23:29:06
Your offset time is: 2024-11-26 23:29:06