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 / THEN statement not recorgnized as code

Author
Message
Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 29th Mar 2013 00:49
Well, this should pretty much explain it:

Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 29th Mar 2013 05:00 Edited at: 29th Mar 2013 05:41
Well I found what my mistake was. I was following this tutorial set

The Monster Hunt 3D Tutorials over here: http://www.thegamecreators.com/?m=view_product&id=2030&page=3d_tutorial_index

and me following the section over here: http://www.thegamecreators.com/?m=view_product&id=2030&page=3d_tutorial_3

The tutorial have stated that the if format should be followed as such:

If STATEMENT then CODE EXECUTED IF STATEMENT IS TRUE

but as it turned out, the proper format is:
If STATEMENT
CODE EXECUTED IF STATEMENT IS TRUE
Endif

I don't know if it was a typo or perhaps an older version of the script language but that code gave me an error prior to me fixing the code.

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Mar 2013 07:25 Edited at: 29th Mar 2013 07:26
Both the block and inline method work. And if you want to use ELSE, it only works with the block statement which doesn't use THEN. It's not highlighted because it was omitted from the keywords, a minor bug. You can fix this easily by adding THEN into the keyword file.

In your case, THEN expects something to follow it. A REM statement does not count and therefore you'll get an error.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
ShellfishGames
12
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 29th Mar 2013 10:43
Quote: "Both the block and inline method work. And if you want to use ELSE, it only works with the block statement which doesn't use THEN."


Why shouldn't ELSE work with the inline method?



Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Mar 2013 14:45
Quote: "I don't know if it was a typo or perhaps an older version of the script language but that code gave me an error prior to me fixing the code."


My guess is that you are using an old version of DBPro or an old editor. The then keyword is properly highlighted for me using U7.7RC7 with the current version of the editor.

Quote: "Why shouldn't ELSE work with the inline method?"


It does of course, as you imply.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Mar 2013 15:44
That's new to me. I could've sworn it didn't work inline before. My mistake.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Tobias_Ripper
12
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 29th Mar 2013 16:24
Come to think of it, i gotta update DRpro, thanks for the tip

Isenstadt Studio: http://isenstadtstudio.com/
Composers Page: http://milothatch.isenstadtstudio.com

Login to post a reply

Server time is: 2025-05-17 10:41:14
Your offset time is: 2025-05-17 10:41:14