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.

DarkBASIC Professional Discussion / Help to shorten my code

Author
Message
Daniel wright 2311
User Banned
Posted: 12th Jul 2012 00:27 Edited at: 12th Jul 2012 00:30
This is where I need help,to make my code shorter with in a math caculation.I know,I am stupid for asking,but I just can not update the function on all I have tryed.



Here is the function



my signature keeps being erased by a mod So this is my new signature.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 12th Jul 2012 00:46 Edited at: 12th Jul 2012 00:50
For n = 0 to 100
if health=n then update_bar(n)
next n

Daniel wright 2311
User Banned
Posted: 12th Jul 2012 00:50
Right,thank you,I will try it now,this should work.

my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 12th Jul 2012 00:54
Yea,this works fine,thank you]

my signature keeps being erased by a mod So this is my new signature.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Jul 2012 01:26
Would it not be easier to do this:



Your function is fine as it does the checks anyway...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Daniel wright 2311
User Banned
Posted: 12th Jul 2012 01:54
Quote: "Would it not be easier to do this:"


Why do I fell so stupid right now????????

my signature keeps being erased by a mod So this is my new signature.
GregA
15
Years of Service
User Offline
Joined: 21st Jun 2011
Location:
Posted: 12th Jul 2012 04:20
Quote: "Why do I fell so stupid right now???????"


I was gonna offer all sorts of platitudes about why that was an easy mistake, and all I can offer is...

This one time at work this guy dropped a pallet full of DVD players.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Jul 2012 04:38
Don't be...!


I've done the same myself in the past too... Can't off the top of my head come up with examples but the DVD players doesn't come close...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Daniel wright 2311
User Banned
Posted: 12th Jul 2012 05:44
Quote: "This one time at work this guy dropped a pallet full of DVD players. "


I did this one time when I was a waiter,the restruant was completely full,the food hit the floor,and I was red.

my signature keeps being erased by a mod So this is my new signature.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jul 2012 15:41
Quote: "I did this one time when I was a waiter,the restruant was completely full,the food hit the floor,and I was red.
"


dude... I know that feeling...

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Jul 2012 17:12
Something like this perhaps?

Dinner For One
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jul 2012 17:35
Quote: "Something like this perhaps?

Dinner For One "


ROFL

Daniel wright 2311
User Banned
Posted: 12th Jul 2012 22:42 Edited at: 12th Jul 2012 22:42
Quote: "dude... I know that feeling..."


Im glade Im not the only one here,lol



Quote: "Something like this perhaps?

Dinner For One "


That guy need's to just get rid of that tiger head all together,lol.

my signature keeps being erased by a mod So this is my new signature.
enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 17th Jul 2012 09:07
I actually submitted a program to my programming teacher where I count up a variable in a for-loop where I could just have written a = b.

Login to post a reply

Server time is: 2026-07-07 12:26:34
Your offset time is: 2026-07-07 12:26:34