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 / Runtime Error... You can only INC/DEC variables

Author
Message
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 23rd Jun 2004 01:18
I get this error often stating that I can only INC or DEC a line that follows a INC or DEC statement. Does anyone know what causes this.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Jun 2004 02:07
whats the error?
whats the code that is causing it?

INC var,amount
DEC var,amount

more info


* DBP_NETLIB_v1.4 - w/VARIABLE WATCHER & CONSOLE! * Click Logo
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 23rd Jun 2004 23:37
You cannot use the inc or dec commands for arrays, only variables:

Right
inc player_height,2
inc speed,1
inc velocity#,2.35
dec size#,rate#
dec level,5

Wrong
inc player(2),5
dec speed#(a),3.5
dec velocity#(a,b),5.2

Do you get it now? You can use integers or floats, but you cannot inc or dec arrays, only variables. I hope I cleared it up.

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
[href][/href]
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 24th Jun 2004 04:01
ahhh yes thats what I was thinking...
Ya Well that sucks, I ll just have to copy and paste for an hour!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Jun 2004 04:11
just change INC Array(0),2 to Array(0)=Array(0)+2

too bad dbp doesn't have +=/-= (Array(0)+=2)


* DBP_NETLIB_v1.4 - w/VARIABLE WATCHER & CONSOLE! * Click Logo
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 24th Jun 2004 04:18
Bolt is wrong by the way. You can INC or DEC arrays quite happily (in DBPro anyway)

Try this:




Boo!
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 24th Jun 2004 06:16 Edited at: 24th Jun 2004 06:16
@ cattle rustler

I dont think the method you stated will work, because if you inc by 2 it will keep inc until you state other wise and if you + 2 it will just add 2.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Jun 2004 13:29
Quote: "because if you inc by 2 it will keep inc until you state other wise "


How so? Cause I don't see a loop.

"eureka" - Archimedes
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 24th Jun 2004 16:47
I'm lost in the hypotheticals


* DBP_NETLIB_v1.4 - w/VARIABLE WATCHER & CONSOLE! * Click Logo
hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 24th Jun 2004 17:34
Skeltor, I don't understand what you're saying about CattleRustler's method not working. I use this method all the time. DB is the only language I know of that has Inc and Dec commands. I'll often find myself doing something like health=health-5 even when I could use the Dec command.

Login to post a reply

Server time is: 2024-11-26 22:40:40
Your offset time is: 2024-11-26 22:40:40