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 / Need Help with Running Total

Author
Message
MRPdeveloper
15
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 28th Sep 2010 12:48
Hey guys im a long time user of Dark GDK and recently moved to Dark Basic Profesional

1 massive problem im having is How do u do a running total in DBP?

for example a running total in Dark gdk is:

Variable ++;
or
Variable += 1;

which will always add 1 to the Varriable if its in the While loop

But in Dark Basic Profesional when i do

Variable ++
or
Variable += 1

it comes up with error how do i do this thanks for the responses
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 28th Sep 2010 13:31 Edited at: 28th Sep 2010 13:31
Those are kinda replaced by INC and DEC, for instance...

var += 1; and var++;
Is
Inc var,1

var -= 1; and var--;
Is
Dec var,1

There is no quick multiplacation or division, so plain old basic for that:

var *= 8;
Is
var = var * 8

Health, Ammo, and bacon and eggs!
gbark
20
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 28th Sep 2010 16:47 Edited at: 28th Sep 2010 16:47
Also, if you're only incrementing by one, the parameter for INC and DEC is not actually required.

So, var++ or var-- could simply be inc var or dec var, respectively. And then var += x or var -= x can be inc var, x and dec var, x.

Just a bit of a shortcut.
MRPdeveloper
15
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 28th Sep 2010 16:52
Thanks guys i understand

Another problem im having is related to Movement

In dark gdk u use

dbMoveObjectUp(
dbMoveObjectDown(
dbMoveObjectLeft(
dbMoveObjectRight(
dbMoveObject(

but in DBP i cannot do these how would i achieve the same outcome?

thanks agien for all feedback
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 28th Sep 2010 17:45
the commands are in DBP, look in the help for

move object left objNo,distance
move object right objNo,distance
move object objNo,distance
etc.

(drop the db and add spaces to convert DGDK commands to DBP )

Login to post a reply

Server time is: 2026-07-24 00:18:42
Your offset time is: 2026-07-24 00:18:42