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 / setting type to 0?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Nov 2010 22:55
Hi guys


Simple question : How can I set every value in a type to 0? The problem is, I have this code here:



Isn't there a way to say EN_Technology(0)=0? Or do I really have to write

EN_Technology(0).MetalMineActive=0
EN_Technology(0).CrystalMineActive=0
EN_Technology(0).DeuteriumSynthActive=0
EN_Technology(0).SolarPlantActive=0

etc...

?

TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 26th Nov 2010 23:04
Redim it?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Nov 2010 23:28
Multiple items in an array can be cleared with the CLEAR ARRAY command from my array plug-in. A single array item can be cleared with the CLEAR ARRAY ITEM command.

If you have to set multiple items in an array to non-zero values, then you can create a variable of the type required, set it's values as required, then assign like so:


Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Nov 2010 23:56
The day will come when I bring a problem that isn't in the matrix1 utils Thanks!

TheComet

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Nov 2010 20:28
Sorry it took so long, I have a lot going on in my life, and didn't get to testing this until now.

Am I using this command correctly?

clear array EN_Technology()


The program crashes without any errors, and I tracked it down to this command...

TheComet

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Nov 2010 20:47
Quote: "Am I using this command correctly?"

It certainly appears so. Can you reproduce the problem is a small snippet and I'll try and work out what's going on.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Nov 2010 21:01
Here you go:



TheComet

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 29th Nov 2010 21:22
Works fine on mine mate :/

Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 29th Nov 2010 21:45
You could just create a variable and leave it empty for assigning zero values to everything.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Nov 2010 21:55
It may be because I have not upgraded DBP yet... Oh well, I better get around to it then Thanks guys!

TheComet

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Nov 2010 10:50
What I do (as previously stated):



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Nov 2010 20:03
Hey, nice idea Sasuke! Until I get the upgrade, I'll give that one a go. Thanks!

TheComet

Login to post a reply

Server time is: 2026-07-21 21:23:35
Your offset time is: 2026-07-21 21:23:35