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 Discussion / Custom data types using DarkEDIT

Author
Message
Ocean Runner
22
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 23rd Jun 2005 07:17
I have heard that it is possible to use custom data types with darkEDIT, and darkbasic 1.13 enchanced. DarkEDIT recognizes the type and endtype command, and highlights them, but the code does not compile. Here is what I have.



What is the syntax for the custom type? Also, is it possible to use arrays with it?

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
James Morgan
20
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 23rd Jun 2005 07:24
I dont have DBC, just DBP but as far as I knew I didnt think DBC could use types.
Your syntax is however correct (other than you dont need the $ for the sting as you have declared at)
You can only create external arrays (if that makes sense) such as
dim image(10) as tImage
but NOT
Type
dim number(2)
Endtype

Hello!
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 23rd Jun 2005 10:36
James Morgan,

May I correct you. In DBC, that syntax is not correct. In general, there is no as in DBC. Neither a variable nor an array can be declared as a type in DBC.

Ocean Runner,

In DBC, there are three different types of variables and arrays. There is string$, real# and integer. Just place the variables associative symbol for that type, in front of the variable name, at any instance it appears within your code.

Run this code:



+NanoBrain+
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 23rd Jun 2005 10:55 Edited at: 23rd Jun 2005 11:03
example of use in DBC, using DE:


DE will translate this into this code:
Ocean Runner
22
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 23rd Jun 2005 11:23
Thanks waffles! But, I tried making my code look like yours, then I tried your code, and both times I got an Unknown Command error. Do you know why? Here is my code:



"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 23rd Jun 2005 11:51 Edited at: 23rd Jun 2005 11:53
do you have darkedit settup to use preprocessors?
Do you have all the options enabled?

Using DarkEdit ...
the settings are under the Edit Menu,
Edit Options ...
Ocean Runner
22
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 23rd Jun 2005 13:36
Ah. That's what I was missing. Thanks!

"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949

Login to post a reply

Server time is: 2025-06-02 16:46:08
Your offset time is: 2025-06-02 16:46:08