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 / Question on Records and Array.

Author
Message
Giku_
14
Years of Service
User Offline
Joined: 14th Jan 2012
Location: The World
Posted: 21st Feb 2012 11:20
Hi guys i'm going to code an inventory management, but with arrays i can't do it aswell because i need a structure like 'Visual Basic' Records, something like:

Code (string)
Description (string)
name (string)
path (string)
ITEMID (integer)
...

As i can see in Dark BASIC Arrays are "mono-type". How can i obtain a structure like this? I heard that it's possibile.

Thanks in advance.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Feb 2012 14:08
You use the TYPE ... ENDTYPE statements to create a structure:


Giku_
14
Years of Service
User Offline
Joined: 14th Jan 2012
Location: The World
Posted: 21st Feb 2012 15:25
haha thanks! it's identical to the Visual Basic one so.

And i have another question if possible: Any suggestions about how to make "savegames" and "loadgames"?
Giku_
14
Years of Service
User Offline
Joined: 14th Jan 2012
Location: The World
Posted: 21st Feb 2012 16:07 Edited at: 21st Feb 2012 16:14
Sorry, and what about a line break command? (using text)
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Feb 2012 17:20
A linebreak is chr$(13) + chr$(10). Rather than writing that out everytime it should give a performance boost to declare a global string containing it and then concatenating that one whereever you need a line break. This is supposedly faster than using IanM's crlf$() function too, since it is just that - a function call with the overheads that implies. If you are not constantly resetting the text such optimisations are pretty useless though

For saving / loading you would simply store all required variables to a file and then read it back in when loading, making sure to update any in-game aspects dependent on those variables.


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2026-07-10 01:06:34
Your offset time is: 2026-07-10 01:06:34